{"id":222216,"date":"2021-07-16T10:13:09","date_gmt":"2021-07-16T02:13:09","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=222216"},"modified":"2021-07-07T11:14:34","modified_gmt":"2021-07-07T03:14:34","slug":"k8s-rancher-eks","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/k8s-rancher-eks.html","title":{"rendered":"\u4e9a\u9a6c\u900ak8s\u5f00\u5c40\uff1a\u521b\u5efa\u56fe\u5f62\u63a7\u5236\u53f0rancher"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u9ed8\u8ba4eks\u521b\u5efa\u597d\u4ee5\u540e\u662f\u6ca1\u6709\u914d\u7f6e\u754c\u9762\u7684\uff0c\u6ca1\u6709\u754c\u9762\u7528\u8d77\u6765\u5b9e\u5728\u5f88\u9ebb\u70e6\u3002\u8fd9\u91cc\u63a8\u8350\u4f7f\u7528rancher2.0\u7684\u9875\u9762\uff0c\u7b80\u5355\u6f02\u4eae\u4f7f\u7528\u65b9\u4fbf\u3002\u9002\u5408\u7814\u53d1\u3001\u6d4b\u8bd5\u7b49\u4eba\u5458\u4f7f\u7528\uff0c\u57fa\u672c\u5c31\u662f\u9f20\u6807\u70b9\u70b9\u70b9\u5c31\u884c\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
rancher\u5b89\u88c5:<\/strong><\/div>\n

\u4f7f\u7528helm\u8fdb\u884c\u5b89\u88c5\u64cd\u4f5c\uff0c\u6240\u4ee5\u8fd9\u91cc\u9700\u8981\u4e0b\u8f7d\u4e00\u4e2ahelm\u5de5\u5177\u3002<\/p>\n

\r\nwget  https:\/\/get.helm.sh\/helm-v3.6.1-linux-amd64.tar.gz\r\ntar -xf helm-v3.6.1-linux-amd64.tar.gz\r\nmv linux-amd64\/helm \/usr\/bin\/\r\n<\/pre>\n

\u6dfb\u52a0\u4ed3\u5e93:<\/p>\n

\r\nhelm repo add rancher-stable https:\/\/releases.rancher.com\/server-charts\/stable\r\nhelm repo update\r\n<\/pre>\n

\u521b\u5efa\u540d\u79f0\u7a7a\u95f4\uff1a<\/p>\n

\r\nkubectl create namespace cattle-system\r\n<\/pre>\n

\u5b89\u88c5rancher\uff1a<\/p>\n

\u56e0\u4e3a\u4e0a\u4e00\u7ae0\u5b89\u88c5\u8d1f\u8f7d\u5747\u8861\u7684\u65f6\u5019\u90e8\u7f72\u4e86cert-manager\u6240\u4ee5\u8fd9\u91cc\u4f7f\u7528Rancher \u751f\u6210\u7684\u81ea\u7b7e\u540d\u8bc1\u4e66\u6765\u5b89\u88c5\u3002<\/p>\n

\r\nhelm install rancher rancher-stable\/rancher  --namespace cattle-system  --set hostname=rancher.xxxx.net  --set replicas=3<\/pre>\n

\u4f7f\u7528kubectl -n cattle-system get pod\u547d\u4ee4\u67e5\u770b\u5b89\u88c5\u60c5\u51b5\u3002<\/p>\n

\u5230\u8fd9\u91cc\u6682\u65f6\u8fd8\u65e0\u6cd5\u8bbf\u95ee\uff0c\u9700\u8981\u7f16\u8f91ingress\u624d\u80fd\u6b63\u5e38\u66b4\u9732\u5904\u7406\uff0c\u5728aws\u7684\u8d1f\u8f7d\u5747\u8861\u4e0a\u6ce8\u518c\u3002<\/p>\n

\r\nkubectl -n cattle-system delete ingress rancher<\/pre>\n

\u4fdd\u5b58\u4e0b\u9762\u7684\u5185\u5bb9\u5230rancher-ingress.yaml\u6587\u4ef6\u4e2d<\/p>\n

\r\napiVersion: extensions\/v1beta1\r\nkind: Ingress\r\nmetadata:\r\n  annotations:\r\n    alb.ingress.kubernetes.io\/certificate-arn: arn:aws:acm:ap-southeast-1:xxxxxxxx:certificate\/34105703-145a-12312-a28e-565e8be89c6a\r\n    alb.ingress.kubernetes.io\/healthcheck-path: \/login\r\n    alb.ingress.kubernetes.io\/listen-ports: '[{\"HTTPS\":443}]'\r\n    alb.ingress.kubernetes.io\/scheme: internet-facing\r\n    alb.ingress.kubernetes.io\/success-codes: 403,404\r\n    alb.ingress.kubernetes.io\/target-type: ip\r\n    kubernetes.io\/ingress.class: alb\r\n    meta.helm.sh\/release-name: rancher\r\n    meta.helm.sh\/release-namespace: cattle-system\r\n    nginx.ingress.kubernetes.io\/proxy-connect-timeout: \"30\"\r\n    nginx.ingress.kubernetes.io\/proxy-read-timeout: \"1800\"\r\n    nginx.ingress.kubernetes.io\/proxy-send-timeout: \"1800\"\r\n  name: rancher\r\n  namespace: cattle-system\r\nspec:\r\n  rules:\r\n  - host: rancher.xxxxx.net\r\n    http:\r\n      paths:\r\n      - backend:\r\n          serviceName: rancher\r\n          servicePort: 80\r\n        pathType: ImplementationSpecific\r\n<\/pre>\n

\u8fd9\u4e2aalb.ingress\u7684\u6ce8\u91ca\u662faws\u7684\u8d1f\u8f7d\u5747\u8861\uff0c\u5177\u4f53\u4f7f\u7528\u65b9\u5f0f\u8bf7\u53c2\u8003<\/p>\n

https:\/\/kubernetes-sigs.github.io\/aws-load-balancer-controller\/v2.2\/guide\/ingress\/annotations\/\r\narn:aws:acm:ap-southeast-1:xxxxxxxx:certificate\/34105703-145a-12312-a28e-565e8be89c6a<\/pre>\n

\u8fd9\u4e2a\u662f\u4e9a\u9a6c\u900a\u4e0a\u7684\u8bc1\u4e66arn\u5185\u5bb9\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u5916\u90e8\u7684\u5176\u5b83\u8bc1\u4e66\u8bf7\u53c2\u8003<\/p>\n

https:\/\/docs.rancher.cn\/docs\/rancher2.5\/installation\/install-rancher-on-k8s\/_index rancher<\/pre>\n

\u5b89\u88c5\u6587\u6863\u3002rules:\u7684hosts\u4fee\u6539\u6210\u81ea\u5df1\u7684\u57df\u540d\u3002<\/p>\n

\u6267\u884c kubectl apply -f rancher-ingress.yaml kubectl -n cattle-system get ingress \u67e5\u770b\u72b6\u6001\uff0c\u5982\u679c\u6210\u529f\u5c31\u4f1a\u5728ADDRESS\u4e00\u680f\u770b\u5230\u5185\u5bb9<\/p>\n

\r\nkubectl -n cattle-system get ingress\r\nNAME      CLASS    HOSTS                ADDRESS                                                                       PORTS   AGE\r\nrancher      rancher.xxxxx.net   k8s-cattlesy-rancher-xxxxx-xxxx.ap-southeast-1.elb.amazonaws.com   80      28s\r\n<\/none><\/pre>\n

\u8fd9\u6837\u6682\u65f6\u8fd8\u65e0\u6cd5\u8bbf\u95ee\uff0c\u4f60\u9700\u8981\u5728dns\u4e2d\u6dfb\u52a0CNAME\u89e3\u6790\u8bb0\u5f55\u6307\u5411\u8fd9\u4e2aADDRESS\u4e2d\u7684\u5730\u5740\u3002<\/p>\n

\u6dfb\u52a0dns:
\n\"\"<\/p>\n

\u89e3\u6790\u5b8c\u6210\u5c31\u53ef\u4ee5\u8f93\u5165\u57df\u540d\u8bbf\u95eerancher\u4e86\u3002\u5982https:\/\/rancher.xxxx.net\u5269\u4e0b\u7684\u5c31\u662f\u8bbe\u7f6e\u5bc6\u7801\uff0c\u7b49\u52a8\u4f5c\u3002<\/p>\n

\"\"<\/p>\n

\u8fd9\u6837\u754c\u9762\u5c31\u7b97\u5b8c\u5168\u5b89\u88c5\u6210\u529f\u4e86\u3002\u4f46\u662f\u76ee\u524d\u8fd8\u4e0d\u80fd\u6b63\u5e38\u4f7f\u7528\uff0c\u6211\u4eec\u8fd8\u7f3a\u5c11\u4e00\u4e9b\u5176\u5b83\u4e1c\u897f\u3002\u6bd4\u5982\u955c\u50cf\u4ed3\u5e93\u8fd9\u4e9b\uff0c\u4e0b\u4e00\u7ae0\u8bb2\u5982\u679c\u81ea\u5efa\u955c\u50cf\u4ed3\u5e93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4f7f\u7528helm\u8fdb\u884c\u5b89\u88c5\u64cd\u4f5c\uff0c\u6240\u4ee5\u8fd9\u91cc\u9700\u8981\u4e0b\u8f7d\u4e00\u4e2ahelm\u5de5\u5177\u3002 wget https:\/\/get.helm.sh […]<\/p>\n","protected":false},"author":362,"featured_media":222219,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-222216","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=222216"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222216\/revisions"}],"predecessor-version":[{"id":222224,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222216\/revisions\/222224"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/222219"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=222216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=222216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=222216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}