Interview Prep/Kubernetes/EKS-specific issues

A new engineer gets `error: You must be logged in to the server (Unauthorized)` on EKS even though their IAM role is in `aws-auth`.

IntermediateTroubleshootingEKS-specific issues
Answer

Likely causes → The ARN in aws-auth does not match what EKS sees: a role ARN with a path (arn:aws:iam::111122223333:role/team/devops) must be written without the path in aws-auth; the user is actually using an SSO session or a different role; or mapUsers used when they assume a role.

Diagnose →

aws sts get-caller-identity
kubectl get configmap aws-auth -n kube-system -o yaml
aws eks list-access-entries --cluster-name prod

Fix → Map the role ARN without the path, or move to EKS access entries, which are API-managed and validated:

aws eks create-access-entry --cluster-name prod --principal-arn arn:aws:iam::111122223333:role/devops
aws eks associate-access-policy --cluster-name prod --principal-arn arn:aws:iam::111122223333:role/devops \
  --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy --access-scope type=cluster

Prevent → Use access entries (authentication mode API) managed in IaC, and give access to roles, not users.

All Kubernetes questions

More on EKS-specific issues