Interview Prep/Networking/Containers, Kubernetes, IPv6 and packet captures

A pod can't reach the EC2 instance metadata service: `curl http://169.254.169.254/latest/meta-data/` hangs, while it works from the node.

IntermediateTroubleshootingContainers, Kubernetes, IPv6 and packet captures
Answer

Likely causes → IMDSv2 with a PUT response hop limit of 1. The token response can't make the extra hop from the node into the pod network namespace, so SDKs hang waiting for a token. This is often intentional, to stop pods from using the node's IAM role.

Diagnose →

aws ec2 describe-instances --instance-ids <id> \
  --query 'Reservations[0].Instances[0].MetadataOptions'
kubectl exec <pod> -- curl -s -m3 -X PUT http://169.254.169.254/latest/api/token \
  -H 'X-aws-ec2-metadata-token-ttl-seconds: 60'

Fix → Preferred: give the pod its own IAM role via EKS Pod Identity or IRSA, so it doesn't need IMDS credentials. If it truly needs IMDS (e.g. some agents), set HttpPutResponseHopLimit=2 on the launch template.

Prevent → Keep hop limit 1 by default, block IMDS with a NetworkPolicy for app namespaces, and use per-pod identities.

All Networking questions Roadmap: Networking for DevOps

More on Containers, Kubernetes, IPv6 and packet captures