Thursday, August 10, 2023

Rollback a Deployment in Kubernetes

 

To rollback the recent release of the `nginx-deployment` in your Kubernetes cluster, you can use the `kubectl rollout undo` command. Here's the command you can use:

# kubectl rollout undo deployment/nginx-deployment

This command will rollback the `nginx-deployment` to the previous revision, effectively reverting the recent release and resolving the reported bug. Make sure to run this command on the machine where you have the `kubectl` utility configured to work with your Kubernetes cluster. After executing this command, Kubernetes will handle the rollback process and ensure that the previous version of the deployment is restored.


To check the status and progress of the rollback process for the `nginx-deployment`, you can use the `kubectl rollout status` command. Here's how you can do it:


# kubectl rollout status deployment/nginx-deployment


Running this command will provide you with information about the current status of the rollback, including whether it's in progress or if it has successfully completed.

Additionally, you can use the `kubectl get pods` command to see the status of the pods associated with the `nginx-deployment`. This will help you verify that the pods are being rolled back to the previous revision.

# kubectl get pods -l app=nginx

Replace `-l app=nginx` with the appropriate label selector for your deployment.

These commands will help you monitor and confirm the progress of the rollback process for the `nginx-deployment`.

No comments:

Post a Comment

Troubleshoot issue with Pods - Part 2

  Troubleshoot issue with Pods - Part 2 To verify if there are any port conflicts between the containers and ensure that the container ports...