EKS 노드 그룹의 AutoScalingGroup의 이름을 확인하고 최대 용량을 4개로 증가 시킵니다. 그리고 AutoScalingGroup의 값을 다시 확인 합니다.
# we need the ASG name
export ASG_NAME=$(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='eksworkshop-eksctl']].AutoScalingGroupName" --output text)
# increase max capacity up to 4
aws autoscaling \
update-auto-scaling-group \
--auto-scaling-group-name ${ASG_NAME} \
--min-size 3 \
--desired-capacity 3 \
--max-size 4
# Check new values
aws autoscaling \
describe-auto-scaling-groups \
--query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='eksworkshop-eksctl']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" \
--output table
2. IAM roles 생성하기
Amazon EKS 클러스터의 service account에 대한 IAM 역할을 사용하려면, IAM 역할을 쿠버네티스 서비스 계정과 연결해야 합니다. 그러면 해당 service account을 사용하는 모든 파드의 컨테이너에 AWS 권한을 제공 할 수 있습니다. 이 기능을 사용하면 해당 노드의 파드가 AWS API를 호출 할 수 있도록 하여 더 이상 노드 IAM 역할에 확장 권한을 제공 할 필요가 없습니다.
# we need to retrieve the latest docker image available for our EKS version
export K8S_VERSION=$(kubectl version --short | grep 'Server Version:' | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' | cut -d. -f1,2)
export AUTOSCALER_VERSION=$(curl -s "https://api.github.com/repos/kubernetes/autoscaler/releases" | grep '"tag_name":' | sed -s 's/.*-\([0-9][0-9\.]*\).*/\1/' | grep -m1 ${K8S_VERSION})
kubectl -n kube-system \
set image deployment.apps/cluster-autoscaler \
cluster-autoscaler=us.gcr.io/k8s-artifacts-prod/autoscaling/cluster-autoscaler:v${AUTOSCALER_VERSION}
EC2 AWS Management Console에서 Auto Scaling 그룹이 수요를 충족하도록 확장되는지 확인 합니다. 이 작업은 몇 분 정도 걸릴 수 있습니다. 명령 줄에서 파드 배포를 수행 할 수도 있습니다. 노드가 확장됨에 따라 파드가 pending에서 running으로 전환 되는 것을 확인 할 수도 있습니다.