Amazon Elastic Kubernetes Service(Amazon EKS) 클러스터 컨트롤 플레인에 새 서브넷을 추가하고 싶습니다.
간략한 설명
새 가용 영역에 서브넷을 추가하거나 기존 가용 영역에서 서브넷을 제거하는 경우 다음과 유사한 오류 메시지가 표시될 수 있습니다.
“An error occurred (InvalidParameterException) when calling the UpdateClusterConfig operation: Provided subnets belong to the AZs 'us-west-2a,us-west-2c,us-west-2d'. But they should belong to the exact set of AZs 'us-west-2a,us-west-2c' in which subnets were provided during cluster creation.”
서브넷은 사용자가 클러스터를 생성할 때 AWS에서 선택한 것과 동일한 가용 영역 세트에 있어야 합니다. 또한 서브넷은 사용자가 클러스터를 생성할 때 AWS에서 제공한 것과 동일한 Amazon Virtual Private Cloud(Amazon VPC)에 있어야 합니다. VPC에는 클러스터에 사용할 수 있는 충분한 IP 주소가 있어야 합니다. 자세한 내용은 서브넷 생성 및 VPC 요구 사항 및 고려 사항을 참조하십시오.
해결 방법
Amazon EKS 클러스터 서브넷을 수정하려면 Amazon EKS 콘솔, AWS CLI 또는 eksctl CLI를 사용하면 됩니다.
Amazon EKS 콘솔 사용
다음 단계를 완료하십시오.
- Amazon EKS 콘솔을 엽니다.
- 탐색 창에서 클러스터를 선택합니다.
- 네트워크를 선택한 다음 VPC 리소스 관리를 선택합니다.
- 서브넷 메뉴에서 추가할 서브넷을 선택합니다.
- 저장을 선택합니다.
- 네트워크 섹션에서 서브넷이 추가되었는지 확인합니다.
AWS CLI 사용
참고: AWS Command Line Interface(AWS CLI) 명령을 실행할 때 오류가 발생하면 AWS CLI의 오류 해결을 참조하십시오. 또한 최신 AWS CLI 버전을 사용하고 있는지 확인하십시오.
AWS CLI 명령은 기존 클러스터 서브넷을 사용자가 명령에 포함하는 서브넷으로 대체합니다. 서브넷을 추가하려면 기존 서브넷과 추가 서브넷을 지정합니다.
-
describe-subnets 명령을 실행하여 EKS 클러스터에 구성한 가용 영역을 식별합니다.
aws ec2 describe-subnets --subnet-ids $(aws eks describe-cluster --name your-cluster-name --query 'cluster.resourcesVpcConfig.subnetIds' --output text) --query 'Subnets[*].AvailabilityZone'
참고: your-cluster-name을 해당 클러스터 이름으로 바꾸고 예제 서브넷 ID를 해당 서브넷 ID로 바꾸십시오.
출력 예시:
[
"us-west-2c",
"us-west-2d",
"us-west-2a"
]
-
update-cluster-config 명령을 실행하여 클러스터 컨트롤 플레인 서브넷을 업데이트합니다.
aws eks update-cluster-config --name your-cluster-name \
--resources-vpc-config subnetIds=subnet-1234,subnet-5678,subnet-9101
참고: your-cluster-name을 해당 클러스터 이름으로 바꾸고 예제 서브넷 ID를 해당 서브넷 ID로 바꾸십시오. 새 서브넷을 추가할 때는 원래 세트의 각 가용 영역을 하나 이상의 서브넷으로 나타내야 합니다. 가용 영역의 기존 서브넷을 유지하려면 명령에 서브넷을 포함하십시오.
다음 예에서는 EKS 클러스터의 현재 가용 영역을 가져와서 기존 영역에 새 서브넷을 추가합니다. update-cluster-config 명령에는 클러스터의 가용 영역 구성을 유지하고 각 영역의 서브넷을 확장하기 위해 원본 및 새 서브넷이 포함됩니다.
aws eks describe-cluster --name gpusharing-demo --query 'cluster.resourcesVpcConfig.subnetIds'
[
"subnet-03d59dfc8d9380b4c",
"subnet-0c4f51f27d109fa32",
"subnet-037b42db1a08da5ae"
]
aws eks update-cluster-config --name gpusharing-demo --resources-vpc-config subnetIds=subnet-xxxxxxx80b4c,subnet-xxxxxxx8da5ae,subnet-xxxxxxx9fa32,subnet-xxxxxxee3bb,subnet-xxxxxxa761ac,subnet-xxxxxxde8b8
{
"update": {
"id": "e7ed1fbf-01ab-3472-8204-149cdc3337be",
"status": "InProgress",
"type": "VpcConfigUpdate",
"params": [
{
"type": "Subnets",
"value": "[subnet-xxxxxxx80b4c, subnet-xxxxxxx8da5ae, subnet-xxxxxxxx9fa32, subnet-xxxxxxxee3bb, subnet-xxxxxxxxa761ac, subnet-xxxxxxde8b8]"
}
],
"createdAt": "2024-09-09T18:06:16.493000+00:00",
"errors": []
}
}
eksctl CLI 사용
eksctl CLI 명령은 기존 클러스터 서브넷을 사용자가 명령에 포함하는 서브넷으로 대체합니다. 서브넷을 추가하려면 기존 서브넷과 추가 서브넷을 지정합니다.
다음 eksctl 명령을 실행하여 클러스터 컨트롤 플레인 서브넷을 업데이트합니다.
eksctl utils update-cluster-vpc-config --cluster=your-cluster-name \
--control-plane-subnet-ids=subnet-1234,subnet-5678 --approve
다음 예제 출력은 각 가용 영역에서 클러스터가 하나의 서브넷으로 업데이트되었음을 보여줍니다.
eksctl utils update-cluster-vpc-config --cluster=gpusharing-demo --control-plane-subnet-ids=subnet-03d59dfc8d9380b4c,subnet-0c4f51f27d109fa32,subnet-037b42db1a08da5ae --approve
2024-09-09 18:23:54 [ℹ] using region us-west-2
2024-09-09 18:23:54 [ℹ] will update control plane subnet IDs for cluster "gpusharing-demo" in "us-west-2" to: [subnet-xxxxxxx80b4c subnet-xxxxxxx9fa32 subnet-xxxxxx8da5ae]
2024-09-09 18:32:07 [✔] control plane subnets and security groups for cluster "gpusharing-demo" in "us-west-2" have been updated to: controlPlaneSubnetIDs=[subnet-xxxxxxx80b4c subnet-xxxxxxxx9fa32 subnet-xxxxxxxx8da5ae], controlPlaneSecurityGroupIDs=[sg-xxxxx31d2]
config.yaml 파일을 사용하여 서브넷을 업데이트하려면 다음 명령을 실행합니다.
eksctl utils update-cluster-vpc-config -f config.yaml
출력 예시:
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: cluster
region: us-west-2
vpc:
controlPlaneSubnetIDs: [subnet-1234, subnet-5678, subnet-9101]
controlPlaneSecurityGroupIDs: [sg-1234, sg-5678]
관련 정보:
VPC 유연성 향상: Amazon EKS에서 서브넷 및 보안 그룹 수정
eksctl 웹 사이트에서 컨트롤 플레인 서브넷 및 보안 그룹 업데이트