Interview Prep/Real-World Interview/Deployments and releases

You deployed a new version and half the pods are in CrashLoopBackOff. What do you do?

BeginnerScenarioDeployments and releases
Answer

Situation read → A rolling update with a sane maxUnavailable keeps old pods serving, so this is usually a stalled rollout, not a full outage. Check that first.

What I'd do →

  1. Check whether traffic is still served by old pods, and pause the rollout so it stops replacing healthy ones.
kubectl rollout status deployment/api -n prod
kubectl rollout pause deployment/api -n prod
  1. Read why the new pods die.
kubectl logs deploy/api -n prod --previous
kubectl describe pod <new-pod> -n prod | sed -n '/Last State/,/Events/p'
  1. Typical culprits: missing env var or secret, failed DB connection, wrong command, OOMKilled (exit 137), or a liveness probe that fires before the app is ready.
  2. If the fix isn't obvious in five minutes: kubectl rollout undo deployment/api -n prod.
  3. Fix in Git, push through the pipeline, never hot-edit the live Deployment.

Why → Pausing preserves the remaining healthy capacity; --previous shows the logs of the crashed container, not the new attempt.

Interview tip → Mention exit codes: 1 is an app error, 137 is OOMKilled or SIGKILL, 143 is SIGTERM.

All Real-World Interview questions Roadmap: Interview readiness

More on Deployments and releases