A deployment to production just failed halfway. What do you do?
In one line: First protect users — check impact and roll back or stop the rollout if needed — then find out why it failed, fix it through the pipeline, and make sure the next deployment can't fail the same way.
Step 1 — Assess impact immediately
- Is the site working? Check error rates, latency and health checks.
- Are old and new versions both running (a half-finished rolling update)?
- Is any data affected (a migration that partly ran)?
Step 2 — Stabilise
- If users are affected: roll back to the last good version (
helm rollback,kubectl rollout undo, revert in GitOps, switch blue/green back, abort the canary). - If users aren't affected (for example the old version is still serving everything): pause the rollout and investigate calmly.
- Communicate in the team/incident channel what's happening.
Step 3 — Find the cause
- Pipeline logs: which step failed and with what error?
- Kubernetes:
kubectl rollout status,kubectl describe pod,kubectl logs --previous, events. Common causes:ImagePullBackOff— wrong tag, missing image, registry permissions.CrashLoopBackOff— app startup error, missing config or secret.- Readiness probe failing — the new version never becomes ready.
- Not enough cluster capacity — pods stuck
Pending.
- Database migration errors or timeouts.
- Expired credentials or changed permissions used by the pipeline.
Step 4 — Fix properly
- Fix the code, config or permissions, and redeploy through the pipeline (not by hand).
- If a migration partly ran, follow the migration tool's recovery steps carefully.
Step 5 — Prevent it next time
- Add the missing test (for example a startup test with production-like config in staging).
- Keep staging closer to production.
- Use progressive delivery with automatic rollback on failed health checks.
- Make database migrations backward compatible and separate from app deploys.
Example: a deploy failed because the new version expected a secret that existed in staging but not production. The team rolled back automatically (readiness never passed, so the old pods kept serving), added the secret via External Secrets, and added a pipeline check that compares required config keys across environments.
Tip for interviews: say "stabilise first, investigate second" — interviewers want to hear that you protect users before debugging.