Pods on EKS fail to pull from ECR with `failed to resolve reference ... 401 Unauthorized` or `no basic auth credentials`.
IntermediateTroubleshootingEKS-specific issues
Answer
Likely causes → The kubelet uses the node IAM role (through the ECR credential provider) to pull, not the Pod's IRSA role. The node role lacks AmazonEC2ContainerRegistryReadOnly, the repo is in another account without a repository policy, or in private subnets the ECR VPC endpoints are missing (i/o timeout rather than 401).
Diagnose →
aws iam list-attached-role-policies --role-name eks-node-role
aws ecr get-repository-policy --repository-name web # cross-account
# On the node
sudo crictl pull 111122223333.dkr.ecr.ap-south-1.amazonaws.com/web:1.4
Fix → Attach the ECR read policy to the node role; for cross-account, add a repository policy allowing the node role's account; add ecr.api, ecr.dkr interface endpoints and the S3 gateway endpoint for private subnets.
Prevent → Node role policies in IaC; ECR replication to each account/region that pulls.
More on 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`.IntermediateAfter someone edited `aws-auth`, all nodes went `NotReady` and nobody except the cluster creator can use kubectl.AdvancedA managed node group fails with `NodeCreationFailure: Instances failed to join the kubernetes cluster`.IntermediatePods are stuck in ContainerCreating and the aws-node logs show `InsufficientFreeAddressesInSubnet` / `failed to assign an IP address to container`.AdvancedAfter enabling prefix delegation (`ENABLE_PREFIX_DELEGATION=true`), nodes still cap at 29 Pods.IntermediateAn app using IRSA fails with `AccessDenied: Not authorized to perform sts:AssumeRoleWithWebIdentity`.Advanced