How do Deployments handle rollbacks?

Kubernetes Deployments handle rollbacks by maintaining a history of previous ReplicaSets associated with the Deployment. When you update a Deployment, Kubernetes creates a new ReplicaSet for the updated version while keeping the old ReplicaSet intact. If the new version encounters issues, you can easily rollback to a previous version using the following steps:

  1. Rollback Command: Use the kubectl rollout undo command to revert to the previous ReplicaSet. For example:

    kubectl rollout undo deployment/<deployment-name>
  2. Check Rollback Status: You can check the status of the rollback using:

    kubectl rollout status deployment/<deployment-name>
  3. Revision History: Kubernetes keeps track of the revision history of the Deployment, allowing you to specify a specific revision to rollback to if needed:

    kubectl rollout undo deployment/<deployment-name> --to-revision=<revision-number>

This mechanism ensures that you can quickly revert to a stable version of your application if a deployment fails or causes issues.

0 Comments

no data
Be the first to share your comment!