Wednesday, September 2, 2026

Using Rolling Updates in Kubernetes

 


What is a Rolling Update?


A Rolling Update is a Kubernetes deployment strategy that updates an application without downtime by gradually replacing old Pods with new Pods.




Why Use Rolling Updates?


No downtime during application updates.

Users can continue accessing the application.

Safer deployment process.

Easy rollback if something goes wrong.



Example:  Suppose you have a Pods running version pod-v1 You update the image to pod-v2, Kubernetes performs the update gradually, Users can access the application throughout the update process.




Perform a Rolling Update


Update the image - kubectl set image deployment/nginx-deployment nginx=nginx:latest

Check update status: - kubectl rollout status deployment/nginx-deployment



View Rollout History


kubectl rollout history deployment nginx-deployment




Rollback to Previous Version


If the new version has issues, then Kubernetes restores the previous working version.


kubectl rollout undo deployment nginx-deployment




Verify Deployment


kubectl get deployments

kubectl get pods




How It Works


Deployment

     |

Rolling Update

     |

Old Pods ---> New Pods

(v1)          (v2)



Kubernetes removes old Pods and creates new Pods gradually until all Pods run the new version.



No comments:

Post a Comment

testing