지난 글
EKS로 Kubernetes Cluster 생성 및 ECR repository 생성 및 push하기: https://cooookieeee.tistory.com/9
진행사항
본 작업은 EKS control plane instance에서 진행되었다.
1. Cluster Autoscaler가 IAM 역할을 사용하기 위해 필요한 권한을 부여하는 IAM 정책을 만든다.
- policy.json 생성 후 aws iam create-policy 명령어를 통해 policy 생성
2. eksctl 명령어를 통해 policy권한으로 Account에 Role을 부여해 해당 AWS resource에 작업을 가능하게 하는
iamserviceaccount를 생성한다.(arn 저장)
- eksctl create iamserviceaccount
3. Cluster -autoscaling.yaml을 apply한다.
- kubectl apply -f cluster-autoscaler-autodiscover.yaml
4. serviceaccount의 annotation에 아까 생성한 iam serviceaccount의 arn을 annotation으로 지정해 policy를 가져온다.
5. Cluster Autoscaling의 배포를 편집한다.
- kubectl -n kube-system edit deployment.apps/cluster-autoscaler
결과
노드 개수 기본 2개
문제점 및 개선점
1. 파드가 FailedScheduling 이벤트 메시지로 보류 중인 문제 (pod 이 자꾸 error 및 pending상태)
-kubectl get events --namespace
-kubectl describe pod YOUR_POD_NAME
-kubectl describe deployments.apps -n kube-system cluster-autoscaler
-kubectl logs Podname
-명령어를 통해 이유를 분석해 보았다.
- 첫번째 가설: t2 micro의 pod 개수 한계가 낮기때문이다. : t2.micro -> t3.medium로 변경시켜주었다.
- 두번째 가설: 쿠버네티스 버전이 낮아서 호환이 안된다: 쿠버네티스 버전을 1.22.1로 업데이트 시켜주었다.
2. Cluster 삭제시 eks delete를 써야한다. 아니면 생성된 resource를 직접 지워야하거나, 지울때 서로 충돌이 일어난다.
Ref
https://docs.aws.amazon.com/ko_kr/eks/latest/userguide/autoscaling.html
-eks CA 설치 aws공홈
https://aws.amazon.com/ko/premiumsupport/knowledge-center/eks-pod-status-troubleshooting/
-pod 문제 상태 해결
https://may9noy.tistory.com/539
-instance type별 배포 가능한 pod 수
-kubernetes label annotation
'융복합 프로젝트 PZONE' 카테고리의 다른 글
<PZONE 프로젝트> 10. RDS 서버 구축 및 Django Service와 연동하기 (0) | 2023.02.21 |
---|---|
<PZONE 프로젝트> 9. HPA 적용하기 , Kube-ops 활용해보기 (0) | 2023.02.21 |
<PZONE 프로젝트> 7. Docker -> Kubernetes 배포환경 Migration하 (0) | 2023.02.21 |
<PZONE 프로젝트> 6. EKS로 Kubernetes Cluster 생성 및 ECR repository 생성 및 push하기 (0) | 2023.02.20 |
<PZONE 프로젝트> 5. Docker-compose로 1차 배포 하기 (0) | 2023.02.20 |