설명
EKS 관리형 노드 그룹에서 ec2_ssh_key만 지정하면 Linux SSH 22번 또는 Windows RDP 3389번 포트를 모든 IPv4 주소에 허용합니다.
잠재적 영향
노드에 연결할 수 있는 호스트라면 관리 포트에 접속을 시도할 수 있습니다. 실제 인터넷 접근 여부는 노드 주소, 경로와 보안 그룹에 따라 달라집니다.
해결 방법
원격 접속이 필요하면 remote_access.source_security_group_ids에 관리 호스트에 연결된 보안 그룹 ID를 지정하고 실제 접속을 시험하세요. 필요 없으면 remote_access를 생략하세요. Session Manager로 전환할 때는 에이전트, IAM 권한과 통신 경로를 먼저 준비하세요.
예시
참조 리소스, 기존 EC2 키 페어와 scaling_config가 필요합니다. 기존 노드 그룹의 원격 접근 설정을 바꾸면 그룹이 교체됩니다. 두 그룹을 함께 운영하며 워크로드를 옮기려면 대체 그룹에 별도 Terraform 리소스와 이름을 사용하세요.
변경 전
hcl
resource "aws_eks_node_group" "example" {
cluster_name = aws_eks_cluster.example.name
node_group_name = "example"
node_role_arn = aws_iam_role.example.arn
subnet_ids = aws_subnet.example[*].id
remote_access {
ec2_ssh_key = "my-rsa-key"
}
}
변경 후
hcl
resource "aws_eks_node_group" "example" {
cluster_name = aws_eks_cluster.example.name
node_group_name = "example"
node_role_arn = aws_iam_role.example.arn
subnet_ids = aws_subnet.example[*].id
remote_access {
ec2_ssh_key = "my-rsa-key"
source_security_group_ids = [aws_security_group.management.id]
}
}