Lab 5: Rolling Updates & Rollback
Keep the visualizer open. Each card shows a version tag and a color, so you can watch old and new pods swap.
Update config → rolling update
Section titled “Update config → rolling update”make color C='#ff6b6b'This changes an env var in the pod template, so the Deployment creates a new ReplicaSet. Watch the visualizer: red cards appear one by one, blue ones disappear, and the errors counter stays at 0.
kubectl get rs -n demo # old ReplicaSet scaled to 0, new one at 3Ship a new image version
Section titled “Ship a new image version”make rollout VERSION=2.0 # builds demo-app:2.0, loads it, runs `kubectl set image`Cards switch from v1.0 to v2.0.
Roll back
Section titled “Roll back”make historymake undoBack to the previous revision within seconds, because the old ReplicaSet was still there.
Deploy a broken version (safely)
Section titled “Deploy a broken version (safely)”kubectl set image deployment/demo app=demo-app:does-not-exist -n demokubectl get pods -n demo # one new pod: ErrImagePull / ImagePullBackOffThe visualizer keeps working. With maxUnavailable: 0, Kubernetes won’t remove a working pod until its replacement is ready, and the broken one never becomes ready. The rollout stalls instead of taking you down.
kubectl rollout status deployment/demo -n demo --timeout=10s # "exceeded its progress deadline" eventuallymake undoClean up the drift
Section titled “Clean up the drift”make color changed the live Deployment directly (imperatively). Reset to what’s in git:
kubectl set env deployment/demo APP_COLOR- -n demo # remove the overridekubectl apply -f k8s/20-deployment.yaml # back to demo-app:1.0Read Zero-downtime deploys → drift for why the first line is needed.
Change the ConfigMap instead
Section titled “Change the ConfigMap instead”Edit APP_MESSAGE in k8s/10-configmap.yaml, then:
kubectl apply -f k8s/10-configmap.yamlcurl -s localhost:8080/api/whoami # still the OLD message! env vars are read at startupkubectl rollout restart deployment/demo -n demo