摘要
本文介绍在AWS中创建EKS集群的过程
参考资料:
创建eks集群
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 $ eksctl create cluster --name eks-lexing --profile eks-us-west-2 2023-06-27 16:49:07 [ℹ] eksctl version 0.146.0 2023-06-27 16:49:07 [ℹ] using region us-west-2 2023-06-27 16:49:07 [ℹ] setting availability zones to [us-west-2a us-west-2b us-west-2d] 2023-06-27 16:49:08 [ℹ] subnets for us-west-2a - public:192.168.0.0/19 private:192.168.96.0/19 2023-06-27 16:49:08 [ℹ] subnets for us-west-2b - public:192.168.32.0/19 private:192.168.128.0/19 2023-06-27 16:49:08 [ℹ] subnets for us-west-2d - public:192.168.64.0/19 private:192.168.160.0/19 2023-06-27 16:49:08 [ℹ] nodegroup "ng-4d9024eb" will use "" [AmazonLinux2/1.25] 2023-06-27 16:49:08 [ℹ] using Kubernetes version 1.25 2023-06-27 16:49:08 [ℹ] creating EKS cluster "eks-lexing" in "us-west-2" region with managed nodes 2023-06-27 16:49:08 [ℹ] will create 2 separate CloudFormation stacks for cluster itself and the initial managed nodegroup 2023-06-27 16:49:08 [ℹ] if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-west-2 --cluster=eks-lexing' 2023-06-27 16:49:08 [ℹ] Kubernetes API endpoint access will use default of {publicAccess=true , privateAccess=false } for cluster "eks-lexing" in "us-west-2" 2023-06-27 16:49:08 [ℹ] CloudWatch logging will not be enabled for cluster "eks-lexing" in "us-west-2" 2023-06-27 16:49:08 [ℹ] you can enable it with 'eksctl utils update-cluster-logging --enable-types={SPECIFY-YOUR-LOG-TYPES-HERE (e.g. all)} --region=us-west-2 --cluster=eks-lexing' 2023-06-27 16:49:08 [ℹ] 2 sequential tasks: { create cluster control plane "eks-lexing" , 2 sequential sub-tasks: { wait for control plane to become ready, create managed nodegroup "ng-4d9024eb" , } } 2023-06-27 16:49:08 [ℹ] building cluster stack "eksctl-eks-lexing-cluster" 2023-06-27 16:49:09 [ℹ] deploying stack "eksctl-eks-lexing-cluster" 2023-06-27 16:49:39 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:50:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:51:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:52:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:53:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:54:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:55:09 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:56:10 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:57:10 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 16:58:10 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-cluster" 2023-06-27 17:00:15 [ℹ] building managed nodegroup stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:00:16 [ℹ] deploying stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:00:16 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:00:46 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:01:25 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:03:16 [ℹ] waiting for CloudFormation stack "eksctl-eks-lexing-nodegroup-ng-4d9024eb" 2023-06-27 17:03:16 [ℹ] waiting for the control plane to become ready 2023-06-27 17:03:16 [✔] saved kubeconfig as "/Users/hanqf/.kube/config" 2023-06-27 17:03:16 [ℹ] no tasks 2023-06-27 17:03:16 [✔] all EKS cluster resources for "eks-lexing" have been created 2023-06-27 17:03:17 [ℹ] nodegroup "ng-4d9024eb" has 2 node(s) 2023-06-27 17:03:17 [ℹ] node "ip-192-168-16-155.us-west-2.compute.internal" is ready 2023-06-27 17:03:17 [ℹ] node "ip-192-168-48-14.us-west-2.compute.internal" is ready 2023-06-27 17:03:17 [ℹ] waiting for at least 2 node(s) to become ready in "ng-4d9024eb" 2023-06-27 17:03:17 [ℹ] nodegroup "ng-4d9024eb" has 2 node(s) 2023-06-27 17:03:17 [ℹ] node "ip-192-168-16-155.us-west-2.compute.internal" is ready 2023-06-27 17:03:17 [ℹ] node "ip-192-168-48-14.us-west-2.compute.internal" is ready 2023-06-27 17:03:19 [ℹ] kubectl command should work with "/Users/hanqf/.kube/config" , try 'kubectl get nodes' 2023-06-27 17:03:19 [✔] EKS cluster "eks-lexing" in "us-west-2" region is ready
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 apiVersion: v1 clusters: - cluster: certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1EWXlPREEyTWpNeU1Wb1hEVE16TURZeU5UQTJNak15TVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTXJVCk94RHJUTHR1lKeWUzUkQxQXFpeTdnUCtROApGdGNOSkNaUzJHSkV3d1hYcmZEK25YL0F1dFo2NVh0ZVR0KzdNZmdnQW1UVWNSaTM0cEhJcVhmN0R0eHY2VnhJCnVBUk9rbzhQRWIyNUpsYVRDRU9GWkRHeXJPdjlDMjE0ZEdudzJFRFV2QVJMR0E1bW5PN0EwanZlRG1zQWcrTzgKZGx3PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== server: https://1029FF88CB872B655555565D44191A56.gr7.us-west-2.eks.amazonaws.com name: eks-lexing.us-west-2.eksctl.io contexts: - context: cluster: eks-lexing.us-west-2.eksctl.io user: hanqunfeng@eks-lexing.us-west-2.eksctl.io name: hanqunfeng@eks-lexing.us-west-2.eksctl.io current-context: hanqunfeng@eks-lexing.us-west-2.eksctl.io kind: Config preferences: {} users :- name: hanqunfeng@eks-lexing.us-west-2.eksctl.io user: exec : apiVersion: client.authentication.k8s.io/v1beta1 args: - eks - get-token - --output - json - --cluster-name - eks-lexing - --region - us-west-2 command : aws env : - name: AWS_STS_REGIONAL_ENDPOINTS value: regional - name: AWS_PROFILE value: eks-us-west-2 interactiveMode: IfAvailable provideClusterInfo: false
1 2 3 4 $ aws eks update-kubeconfig --name eks-lexing --profile eks-us-west-2 $ export AWS_PROFILE=eks-us-west-2 $ aws eks update-kubeconfig --name eks-lexing
1 2 3 4 5 6 7 8 9 10 11 12 $ eksctl get nodegroup --cluster eks-lexing --profile eks-us-west-2 CLUSTER NODEGROUP STATUS CREATED MIN SIZE MAX SIZE DESIRED CAPACITY INSTANCE TYPE IMAGE ID ASG NAME TYPE eks-lexing ng-4d9024eb ACTIVE 2023-06-28T06:30:03Z 2 5 2 m5.large AL2_x86_64 eks-ng-4d9024eb-20c48058-e974-c6ec-786a-516c31131604 managed $ k get ns NAME STATUS AGE default Active 11m kube-node-lease Active 11m kube-public Active 11m kube-system Active 11m
小贴士
不要手工修改EC2
下关于eks的Auto Scaling 组,如果要修改弹性伸缩,需要在EKS
的工作节点组的配置中进行修改
后续