Skip to content
StackDecode
IntermediateLesson 11 of 35

Rolling updates and rollbacks

Ship new versions with no downtime, and undo them quickly.

Changing a Deployment's pod template triggers a rolling update: new pods start before old ones stop.

yaml
strategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 1 # extra pods allowed during the update
    maxUnavailable: 0 # never drop below the desired count
bash
kubectl set image deployment/web web=nginx:1.28
kubectl rollout status deployment/web
kubectl rollout history deployment/web
kubectl rollout undo deployment/web

kubectl rollout restart deployment/web recreates pods without changing the spec.