로드 밸런서 또는 수신 컨트롤러의 자동 서브넷 검색을 위해 Amazon EKS 클러스터의 Amazon VPC 서브넷에 태그를 지정하려면 어떻게 해야 하나요?

3분 분량
0

Amazon Virtual Private Cloud(Amazon VPC)의 퍼블릭 또는 프라이빗 서브넷에 로드 밸런서 또는 수신 컨트롤러를 배포하려고 합니다. Amazon Elastic Kubernetes Service(Amazon EKS) 클러스터에서 Kubernetes로 서브넷을 검색할 수 없는 이유는 무엇인가요?

간략한 설명

Kubernetes Cloud Controller Manager(cloud-controller-manager) 및 AWS Load Balancer Controller(aws-load-balancer-controller)는 클러스터의 서브넷을 쿼리하여 식별합니다. 이 쿼리는 다음 태그를 필터로 사용합니다.

kubernetes.io/cluster/cluster-name

참고: cluster-name을 해당하는 Amazon EKS 클러스터 이름으로 바꾸세요.

Cloud Controller Manager와 AWS Load Balancer Controller에는 서브넷에 다음 태그 중 하나가 있어야 합니다.

kubernetes.io/role/elb

또는

kubernetes.io/role/internal-elb

참고: 앞의 태그를 사용하지 않는 경우 Cloud Controller Manager는 연결된 라우팅 테이블을 검사하여 서브넷이 퍼블릭 또는 프라이빗인지 확인합니다. 프라이빗 서브넷과 달리 퍼블릭 서브넷은 인터넷 게이트웨이를 사용하여 인터넷으로 직접 경로를 가져옵니다.

서브넷을 어느 태그와도 연결하지 않고 AWS Load Balancer Controller를 사용하는 경우 오류가 발생합니다.

예를 들어, Kubernetes 서비스의 문제를 해결하고 kubectl describe service your-service-name 명령을 실행하면 다음과 같은 오류가 발생합니다.

Events:
  Type     Reason                      Age               From                Message
  ----     ------                      ----              ----                -------
  Normal   EnsuringLoadBalancer        9s (x2 over 14s)  service-controller  Ensuring load balancer
  Warning  CreatingLoadBalancerFailed  9s (x2 over 14s)  service-controller  Error creating load balancer (will retry): failed to ensure load balancer for service default/guestbook: could not find any suitable subnets for creating the ELB

Application Load Balancer Ingress Controller 문제를 해결하고 kubectl logs your-aws-load-balancer-controller-pod-name 명령을 실행하면 다음과 같은 오류가 발생합니다.

E0121 22:44:02.864753       1 controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to build LoadBalancer configuration due to
retrieval of subnets failed to resolve 2 qualified subnets. Subnets must contain the kubernetes.io/cluster/\u003ccluster name\u003e tag with a value of shared or owned and the kubernetes.io/role/elb tag signifying it should be used for ALBs Additionally, there must be at least 2 subnets with unique availability zones as required by ALBs. Either tag subnets to meet this requirement or use the subnets annotation on the ingress resource to explicitly call out what subnets to use for ALB creation. The subnets that did resolve were []"  "controller"="alb-ingress-controller" "request"={"Namespace":"default","Name":"2048-ingress"}

참고: eksctl을 사용하여 VPC를 생성하는 경우 해당 VPC의 모든 서브넷에는 kubernetes.io/role/elbkubernetes.io/role/internal-elb 태그가 있습니다.

해결 방법

서브넷에 태그를 지정하기 위한 적절한 옵션을 선택합니다.

로드 밸런서 리소스에서 사용하는 퍼블릭 및 프라이빗 서브넷의 경우

다음 키–값 페어를 사용하여 클러스터가 로드 밸런서 리소스에 사용하는 모든 퍼블릭 및 프라이빗 서브넷에 태그를 지정합니다.

Key: kubernetes.io/cluster/cluster-name
Value: shared

참고: cluster-name을 해당하는 Amazon EKS 클러스터 이름으로 바꾸세요. shared 값은 둘 이상의 클러스터가 서브넷을 사용할 수 있도록 허용합니다.

내부 로드 밸런서가 사용하는 프라이빗 서브넷의 경우

Kubernetes가 내부 로드 밸런서에 프라이빗 서브넷을 사용하도록 허용하려면 다음 키–값 페어를 사용하여 VPC의 모든 프라이빗 서브넷에 태그를 지정합니다.

Key: kubernetes.io/role/internal-elb
Value: 1

외부 로드 밸런서가 사용하는 퍼블릭 서브넷의 경우

Kubernetes가 외부 로드 밸런서에 태그가 지정된 서브넷만 사용하도록 허용하려면 다음 키–값 페어를 사용하여 VPC의 모든 퍼블릭 서브넷에 태그를 지정합니다.

Key: kubernetes.io/role/elb
Value: 1

참고: 각 가용 영역에서 퍼블릭 서브넷을 사용하는 대신, 앞의 태그를 사용합니다.


관련 정보

Amazon EKS VPC 및 서브넷 요구 사항 및 고려 사항

GitHub 웹 사이트에서 서브넷 자동 검색

Amazon EKS에서 애플리케이션 로드 밸런싱

AWS 공식
AWS 공식업데이트됨 일 년 전