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 →
- 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
- 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'
- 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. - If the fix isn't obvious in five minutes:
kubectl rollout undo deployment/api -n prod. - 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.
More on Deployments and releases
A deploy went out and p99 latency doubled. Walk me through it.IntermediateA release passed every test in staging but broke in production. How do you investigate?IntermediateHow would you design a zero-downtime deployment for a stateless API on Kubernetes?BeginnerEvery deploy causes a short spike of 502 errors from the ALB. Why, and how do you fix it?IntermediateHow would you set up a canary release, and what decides whether it gets promoted?IntermediateBlue-green or canary? How do you choose for a specific service?Beginner