Live task: a pod can't reach an external API, but other pods can. Find the cause.
AdvancedHands-onLive debugging tasks
Answer
kubectl get pod payments-abc -o wide # namespace, node, IP
kubectl get networkpolicy -n payments # an egress policy only in this namespace?
kubectl describe networkpolicy -n payments
kubectl exec -n payments payments-abc -- nslookup api.stripe.com # DNS egress (UDP/TCP 53) allowed?
kubectl exec -n payments payments-abc -- curl -sv --max-time 5 https://api.stripe.com
kubectl get pod payments-abc -o jsonpath='{.spec.dnsPolicy} {.spec.hostNetwork}'
Typical finding: a default-deny egress NetworkPolicy in that namespace allows the app's port but not DNS to kube-dns on port 53. Fix by adding an egress rule to the kube-system CoreDNS pods on UDP and TCP 53, plus 443 to the external range. Other possibilities: per-pod security groups (EKS Security Groups for Pods), or the pod landing on a node in a subnet without a NAT route.
Key trick → "Only this pod fails" means compare what is unique to it: namespace policies, node or subnet, service account, and pod-level security groups.
More on Live debugging tasks
A pod is in CrashLoopBackOff. You have 10 minutes. Walk through your commands.BeginnerThe pod shows `OOMKilled`. Diagnose and fix it.BeginnerA pod is stuck in `ImagePullBackOff`. Fix it.BeginnerA pod is `Pending` forever. What do you check?AdvancedThe Service returns "connection refused" but pods are Running. Debug it.IntermediateA Docker container exits immediately after `docker run -d`. Find out why.Beginner