Interview Prep/Kubernetes/EKS-specific issues

An app's AWS calls succeed but use the node's role instead of the IRSA role, and fail with `AccessDenied` on the S3 bucket.

IntermediateTroubleshootingEKS-specific issues
Answer

Likely causes → The Pod did not get the web-identity env vars: the ServiceAccount annotation was added after the Pod started (the mutating webhook injects only at creation), the Pod uses a different ServiceAccount, or the AWS SDK is too old to support web identity and falls back to IMDS (the node role).

Diagnose →

kubectl exec api-x -n payments -- env | grep -E 'AWS_ROLE_ARN|AWS_WEB_IDENTITY_TOKEN_FILE'
kubectl exec api-x -n payments -- aws sts get-caller-identity
kubectl get pod api-x -n payments -o jsonpath='{.spec.serviceAccountName}{"\n"}'

Fix → Restart the Pods after annotating the SA, use the right SA, upgrade the SDK. Block IMDS from Pods (hop limit 1 on IMDSv2) so they cannot silently fall back to the node role.

Prevent → httpPutResponseHopLimit: 1 and IMDSv2 required in launch templates; a minimal node role.

All Kubernetes questions

More on EKS-specific issues