Interview Prep/AWS/ECS, EKS, ECR and Lambda

Pods stay `Pending` with `0/6 nodes are available: 6 Too many pods`, but the nodes have plenty of CPU and memory.

AdvancedTroubleshootingECS, EKS, ECR and Lambda
Answer

Likely causes → With the VPC CNI, every pod gets a VPC IP, and max pods per node is limited by ENIs × IPs per ENI (for example, 29 on m5.large). Small instance types fill up quickly. The subnet may also be running out of IPs (failed to assign an IP address to container in aws-node logs).

Diagnose →

kubectl get nodes -o custom-columns=NAME:.metadata.name,MAXPODS:.status.allocatable.pods
kubectl -n kube-system logs ds/aws-node -c aws-node | grep -i -E 'insufficient|failed to assign'
aws ec2 describe-subnets --subnet-ids subnet-0abc --query 'Subnets[].AvailableIpAddressCount'

Fix →

  1. Turn on prefix delegation: kubectl set env ds/aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true, and raise max pods (managed node groups and Karpenter calculate it)
  2. Use larger instances
  3. If the subnet is out of IPs, add a secondary CIDR (for example 100.64.0.0/16) with custom networking

Prevent → Plan pod IP capacity at design time (/19 or larger node subnets), and alarm on free IPs per subnet.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, ECR and Lambda