Interview Prep/Kubernetes/Pod startup failures

Pods show `Init:CrashLoopBackOff` after a release that added a migration init container.

IntermediateTroubleshootingPod startup failures
Answer

Likely causes → The init container exits non-zero: migration fails (lock held, schema conflict, bad credentials), so the main container never starts. With several replicas, each Pod runs the migration concurrently and they fight over the lock.

Diagnose →

kubectl logs api-x -c migrate --previous
kubectl get pod api-x -o jsonpath='{.status.initContainerStatuses[*].lastState.terminated}'

Fix → Fix the migration. Move it out of the Pod into a single Job (Helm pre-upgrade hook or Argo CD PreSync) so it runs once, not once per replica.

Prevent → Migrations as Jobs with backoffLimit and a clear failure signal; backward-compatible schema changes so old and new code run side by side.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures