본문 바로가기
CLOUD/AWS

[AWS EKS] aws-auth와 iam role 확인

by Rainbound-IT 2025. 7. 24.
반응형

 

1. aws-auth ConfigMap 확인

먼저 현재 EKS 클러스터에 등록된 aws-auth 내용을 확인합니다:

 
kubectl get configmap aws-auth -n kube-system -o yaml

 

mapRoles 항목에서 다음과 같은 형식으로 되어 있을 겁니다:
mapRoles: |
  - rolearn: arn:aws:iam::<ACCOUNT_ID>:role/<EKSNodeRole>
    username: system:node:{{EC2PrivateDNSName}}
    groups:
      - system:bootstrappers
      - system:nodes
 
 

이 rolearn 값이 EC2 노드에 실제 부여된 IAM 역할정확히 일치해야 합니다.


✅ 2. 실제 EC2 인스턴스의 IAM Role 확인

SSH로 접속 가능한 경우에는 EC2 인스턴스 내부에서 직접 확인:

curl http://169.254.169.254/latest/meta-data/iam/info

예시 출력:

{
  "InstanceProfileArn": "arn:aws:iam::123456789012:instance-profile/eks-node-instance-profile",
  "InstanceProfileId": "AIPAJ5HPLAA...EXAMPLE"
}

또는 CLI로 확인 (필터에 클러스터 이름 사용):

aws ec2 describe-instances \
  --filters Name=tag:eks:cluster-name,Values=<your-cluster-name> \
  --query 'Reservations[].Instances[].IamInstanceProfile.Arn'

✅ 일치 여부 확인 방법

  • aws-auth ConfigMap에 등록된 rolearn 과
  • 위에서 얻은 InstanceProfileArn (에서 role/이 아닌 instance-profile/로 시작함)을 비교

👉 실제 역할 이름은 instance-profile에 연결된 role 입니다. 아래처럼 변환해서 비교하세요:

aws iam get-instance-profile --instance-profile-name <NAME_FROM_ABOVE>

출력:

{
  "InstanceProfile": {
    ...
    "Roles": [
      {
        "Arn": "arn:aws:iam::123456789012:role/<role-name>"
      }
    ]
  }
}

✅ 요약

 

항목확인 방법
aws-auth에 어떤 Role이 등록됐는지 kubectl get configmap aws-auth -n kube-system -o yaml
실제 노드에 부여된 IAM Role curl 169.254.169.254 또는 aws ec2 describe-instances
둘이 일치하는지 검증 iam get-instance-profile로 매핑 확인 후 비교
반응형

댓글