cluster 정보 얻기
$ eksctl get nodegroup --cluster EKS-course-cluster
2021-03-13 18:08:25 [ℹ] eksctl version 0.40.0
2021-03-13 18:08:25 [ℹ] using region us-west-2
CLUSTER NODEGROUP STATUS CREATED MIN SIZE MAX SIZE DESIRED CAPACITY INSTANCE TYPE IMAGE ID ASG NAME
EKS-course-cluster ng-1 CREATE_COMPLETE 2021-03-13T08:48:55Z 3 3 3 t2.small ami-01f2f1180914aad2b eksctl-EKS-course-cluster-nodegroup-ng-1-NodeGroup-1X4BWPMRE6QZ4
MIN SIZE : 최소 노드 사이즈
MAX SIZE : 최대 노드 사이즈
cluster Size 변경하기
$ eksctl scale nodegroup --cluster=EKS-course-cluster --nodes=5 --nodes-max=5 --name=ng-1
2021-03-13 18:18:01 [ℹ] scaling nodegroup "ng-1" in cluster EKS-course-cluster
2021-03-13 18:18:03 [ℹ] scaling nodegroup, desired capacity from 3 to 5, max size from 3 to 5
2021-03-13 18:18:04 [ℹ] waiting for CloudFormation changeset "eksctl-scale-nodegroup-1615627083" for stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:18:20 [ℹ] waiting for CloudFormation changeset "eksctl-scale-nodegroup-1615627083" for stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:18:23 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:18:41 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:19:01 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:19:21 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:19:38 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
2021-03-13 18:19:56 [ℹ] waiting for CloudFormation stack "eksctl-EKS-course-cluster-nodegroup-ng-1"
--nodes : cluster에 등록할 node 수
--nodes-max : 최대 node 수
만약 nodes가 nodes-max보다 높다면 node는 추가 되지 않는다.
Node group 추가하고 Spot Instance Type 섞기
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: EKS-course-cluster
region: us-west-2
nodeGroups:
- name: ng-1
instanceType: t2.small
desiredCapacity: 3
ssh: # use existing EC2 key
publicKeyName: udacity
- name: ng-mixed
minSize: 3
maxSize: 5
instancesDistribution:
maxPrice: 0.2
instanceTypes: ["t2.small", "t3.small"]
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 50
ssh: # use existing EC2 key
publicKeyName: udacity
- ng-mixed 이하 코드가 추가된 코드임
- instancesDistribution : Spot Instance 설정임
- onDemandPercentageAboveBaseCapacity: 50 -> 50%를 ondemand 하고 50%를 Spot instance로 생성 관리
eksctl.io/usage/spot-instances/
t2와 t3 instance type이 섞인것을 확인 가능함
이중 instance id => `i-0a968b80eebf123c8`로 명명되는 인스턴스의 경우 spot instance로 생성 되어있다.
$ eksctl get nodegroup --cluster EKS-course-cluster
2021-03-13 20:37:02 [ℹ] eksctl version 0.40.0
2021-03-13 20:37:02 [ℹ] using region us-west-2
CLUSTER NODEGROUP STATUS CREATED MIN SIZE MAX SIZE DESIRED CAPACITY INSTANCE TYPE IMAGE ID ASG NAME
EKS-course-cluster ng-1 UPDATE_COMPLETE 2021-03-13T08:48:55Z 3 5 3 t2.small ami-01f2f1180914aad2b eksctl-EKS-course-cluster-nodegroup-ng-1-NodeGroup-1X4BWPMRE6QZ4
EKS-course-cluster ng-mixed CREATE_COMPLETE 2021-03-13T11:08:22Z 3 5 0 t2.small ami-01f2f1180914aad2b eksctl-EKS-course-cluster-nodegroup-ng-mixed-NodeGroup-1W27Q1JUTT6ZP
Node Group이 2개로 분리 되어있다.
EKS nodegroup 삭제하기
$ eksctl delete nodegroup --config-file=eks-course.yaml --include=ng-mixed --approve
2021-03-13 20:52:45 [ℹ] eksctl version 0.40.0
2021-03-13 20:52:45 [ℹ] using region us-west-2
2021-03-13 20:52:46 [ℹ] comparing 2 nodegroups defined in the given config ("eks-course.yaml") against remote state
2021-03-13 20:52:46 [ℹ] combined include rules: ng-mixed
2021-03-13 20:52:46 [ℹ] 1 nodegroup (ng-mixed) was included (based on the include/exclude rules)
2021-03-13 20:52:47 [ℹ] will drain 1 nodegroup(s) in cluster "EKS-course-cluster"
2021-03-13 20:52:49 [ℹ] cordon node "ip-192-168-12-117.us-west-2.compute.internal"
2021-03-13 20:52:49 [ℹ] cordon node "ip-192-168-50-49.us-west-2.compute.internal"
2021-03-13 20:52:49 [ℹ] cordon node "ip-192-168-68-94.us-west-2.compute.internal"
2021-03-13 20:52:50 [!] ignoring DaemonSet-managed Pods: kube-system/aws-node-dgbjb, kube-system/kube-proxy-fhjcs
2021-03-13 20:52:50 [!] ignoring DaemonSet-managed Pods: kube-system/aws-node-frqsz, kube-system/kube-proxy-rf5m6
2021-03-13 20:52:51 [!] ignoring DaemonSet-managed Pods: kube-system/aws-node-426st, kube-system/kube-proxy-k5h8l
2021-03-13 20:52:51 [✔] drained all nodes: [ip-192-168-12-117.us-west-2.compute.internal ip-192-168-50-49.us-west-2.compute.internal ip-192-168-68-94.us-west-2.compute.internal]
2021-03-13 20:52:51 [ℹ] will delete 1 nodegroups from cluster "EKS-course-cluster"
2021-03-13 20:52:52 [ℹ] 1 task: { 1 task: { delete nodegroup "ng-mixed" [async] } }
2021-03-13 20:52:52 [ℹ] will delete stack "eksctl-EKS-course-cluster-nodegroup-ng-mixed"
2021-03-13 20:52:52 [ℹ] will delete 1 nodegroups from auth ConfigMap in cluster "EKS-course-cluster"
2021-03-13 20:52:52 [ℹ] removing identity "arn:aws:iam::144965779334:role/eksctl-EKS-course-cluster-nodegro-NodeInstanceRole-1HQ1ND2OI1NXV" from auth ConfigMap (username = "system:node:{{EC2PrivateDNSName}}", groups = ["system:bootstrappers" "system:nodes"])
2021-03-13 20:52:52 [✔] deleted 1 nodegroup(s) from cluster "EKS-course-cluster"
delete를 이용해서 특정 nodegroup을 삭제 할 수 있음
728x90
반응형
'AWS' 카테고리의 다른 글
windows aws cli update (0) | 2022.01.14 |
---|---|
Kubernetes Docker alpine cpu memory process monitoring (0) | 2022.01.13 |
EKS setup and make clustering (0) | 2021.03.13 |
Cloud9 Ports 오픈 하기 (0) | 2021.03.01 |
EC2 Volume Size Extension (0) | 2021.03.01 |