IT기술/클라우드, VM, AWS

[AWS] EKS kubernetes RBAC 권한이 없는 문제 해결하기.

미노드 2025. 2. 25. 16:12

eks를 만들었는데 eks의 내부 정보를 확인할 수 없다...

클러스터 노드의 메트릭정보나 pod정보를 확인할 수 없었다.

어떤 권한을 추가해도 해결할 수 없었는데, 해결방법은 직접 eks에 들어가 auth 정보를 추가해서 RBAC 권한을 획득하는 것이다.

방법은 2가지인데, 아래처럼 eks의 aws-auth Config-Map 에 Role 정보나 IAM 사용자 정보를 추가해주면 된다.

kubectl get configmap -n kube-system

를 해보면 config-map 정보가 나오는데 여기서 aws-auth 정보를 갱신해주면 된다.
kubectl edit configmap aws-auth -n kube-system

아래처럼 수정하면 aws Console에서도 확인 가능하다.

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  mapRoles: |
    - groups:
      - system:bootstrappers
      - system:nodes
      rolearn: arn:aws:iam::430223317801:role/ec2-role-bootstrap-role
      username: system:node:{{EC2PrivateDNSName}}
  mapUsers: |
    - userarn: arn:aws:iam::430223317801:user/rcsp_jhbae_admin
      username: rcsp_jhbae_admin
      groups:
      - system:masters
kind: ConfigMap
metadata:
  creationTimestamp: "2025-02-24T05:28:40Z"
  name: aws-auth
  namespace: kube-system
  resourceVersion: "311297"
  uid: f5ae0fd2-ac35-4ca8-a82a-28999bc1a697

 

수정하게되면, 아래처럼 알림 창이 사라진다.

aws 콘솔에서 노드 정보도 보이게되며, 리소스 확인도 가능해진다.