Rolling Updates & Rollbacks in Deployments
Deployments ensure zero downtime during application upgrades using controlled Rolling Updates.
1. Rolling Update Parameters
Section titled “1. Rolling Update Parameters”maxSurge: The maximum number of Pods that can be created above the desired replica count during an update (e.g.,25%or1).maxUnavailable: The maximum number of Pods that can be unavailable during the update process (set to0to guarantee zero dropped requests).
2. Rollout CLI Workflow
Section titled “2. Rollout CLI Workflow”# Trigger an image updatekubectl set image deployment/web-app web-server=nginx:1.26-alpine --record
# Track rollout statuskubectl rollout status deployment/web-app
# View revision historykubectl rollout history deployment/web-app
# Roll back to the immediately preceding versionkubectl rollout undo deployment/web-app
# Roll back to a specific revisionkubectl rollout undo deployment/web-app --to-revision=2