Interview Prep/Kubernetes/Pod startup failures

Pods are stuck in `Init:0/2` for 20 minutes.

BeginnerTroubleshootingPod startup failures
Answer

Likely causes → The first init container is still running, usually a "wait-for" loop (waiting for DB, a Service, a migration) that never succeeds because the dependency is down or the hostname is wrong.

Diagnose →

kubectl describe pod api-x | sed -n '/Init Containers/,/Containers:/p'
kubectl logs api-x -c wait-for-db
kubectl run tmp --rm -it --image=busybox:1.36 -- nc -zv postgres.data.svc.cluster.local 5432

Fix → Fix the dependency or the address. If the init container is only a crutch, remove it and let the app retry connections itself.

Prevent → Give wait loops a timeout so they fail visibly (Init:CrashLoopBackOff) instead of hanging forever, and prefer app-level retries with backoff.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures