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 →
- 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) - Use larger instances
- 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.
More on ECS, EKS, ECR and Lambda
`docker push 111111111111.dkr.ecr.us-east-1.amazonaws.com/api:1.4` fails with `no basic auth credentials` (or `denied: Your authorization token has expired. Reauthenticate and try again.`).BeginnerFargate tasks stop with `CannotPullContainerError: pull image manifest has been retried 5 time(s): failed to resolve ref ... dial tcp 52.x.x.x:443: i/o timeout`.Intermediate`ResourceInitializationError: unable to pull secrets or registry auth: ... AccessDeniedException: User: arn:aws:sts::111111111111:assumed-role/ecsTaskExecutionRole/... is not authorized to perform: secretsmanager:GetSecretValue`.IntermediateA task stops with `Essential container in task exited`, exit code 137, and reason `OutOfMemoryError: Container killed due to memory usage`.BeginnerThe ECS service event says `service api was unable to place a task because no container instance met all of its requirements. The closest matching container-instance ... has insufficient memory available.`IntermediateAn ECS deployment rolls back automatically, and the event says `deployment failed: tasks failed to start` from the circuit breaker.Advanced