K8s by Example: Rolling Updates
| Rolling updates replace Pods incrementally. Old Pods serve traffic while new ones start. Readiness probes gate traffic to new Pods. This enables zero-downtime deployments. |
| deployment-rolling.yaml | |
| Rolling updates are the default strategy for Deployments. | |
| deployment-strategy.yaml | |
| First example: fast rollout with 25%, allows some downtime. Second example: | |
| terminal | |
| Trigger rollout by changing the Pod template. Image tag, env vars, or labels all trigger updates. Use | |
| terminal | |
| Rollback instantly to a previous revision. Old ReplicaSets are preserved for this purpose. Use history to see available revisions. | |
| deployment-recreate.yaml | |
| Recreate strategy stops all old Pods before starting new ones. Use when you can’t run two versions simultaneously (database schema incompatibility, license limits). Causes downtime during updates. | |