Skip to content

Deployment Rollback

Error message

                Rolling back deployment due to failed rollout
              

Quick summary

The new version of the application is failing, so the deployment is reverted to the previous working version.

Why this happens

  • The new version has a bug that causes crashes or errors

  • The new version fails health checks or readiness probes

  • The new version is incompatible with the current configuration or data

  • A rolling update is stuck because new Pods fail to become ready

Minimal example

✗ Broken code
# New version is failing
kubectl set image deployment/app app=app:v2
# Pods crash, rollout stuck
✓ Fixed code
# Roll back to previous version
kubectl rollout undo deployment/app
# Or roll back to specific revision
kubectl rollout undo deployment/app --to-revision=2

The new version (v2) is failing. The fix rolls back to the previous working version.

How to diagnose

  • Check the rollout status: kubectl rollout status deployment/<name>

  • View the rollout history: kubectl rollout history deployment/<name>

  • Check the new Pods' logs and events for errors

  • Verify if the issue is with the image, configuration, or dependencies

How to fix

  • Roll back to the previous version: kubectl rollout undo deployment/<name>

  • Fix the bug in the new version and redeploy

  • Update the configuration to be compatible with the new version

  • Fix health check endpoints if they are causing the rollback

How to prevent

  • Test new versions in staging before deploying to production

  • Use canary deployments to test with a small percentage of traffic first

  • Set up proper health checks and readiness probes

Related Resources

← Back to language