Why deployment strategy matters
For a popular web application with thousands of users, deploying a new version must avoid downtime and prevent cluster overload. Kubernetes deployment strategies determine how pods are replaced, how traffic is shifted, and how much control you have over rollout speed and failure recovery.- RollingUpdate: Gradual replacement of pods; new pods are created and validated before old ones are removed.
- Recreate: Terminates all old pods first, then starts new pods—simpler but causes downtime.
- Blue-Green and Canary: Provide explicit traffic control for staged exposure of new versions.
Rolling Update (recommended for most stateless apps)
Rolling updates allow Kubernetes to replace pods incrementally. This ensures continuous availability while gradually shifting to the new version. You can control the pace usingmaxSurge, maxUnavailable, and readiness probes/minReadySeconds.
Key benefits:
- Minimal disruption—application remains available during rollout.
- Controlled, incremental changes to limit risk.
- Ability to pause or rollback if problems are detected.
- Developer updates the Deployment manifest in Git (e.g., image tag v1.0 → v2.0).
- GitOps operator (Argo CD, Flux, etc.) detects the change and applies it to the cluster.
- Kubernetes applies the rolling update according to the Deployment strategy settings.
RollingUpdate is the default Deployment strategy. Use
maxSurge and maxUnavailable to control how many pods are added/removed at each step. Combine readiness probes and minReadySeconds to ensure pods serve traffic only after they are healthy.kubectl rollout pause deployment/<name> to investigate failures, and resume or roll back with kubectl rollout resume or kubectl rollout undo respectively.
Recreate (when multiple versions cannot coexist)
The Recreate strategy terminates all existing pods for a Deployment before creating any new pods. This is appropriate when your application cannot safely run multiple versions simultaneously or requires exclusive access to shared resources during startup. When to choose Recreate:- The application cannot safely run multiple versions concurrently.
- Short, acceptable downtime is preferable to complex coordination.
- Legacy or stateful services that require exclusive initialization.
- The manifest is updated and pushed to Git.
- The GitOps operator applies the change.
- Kubernetes deletes all existing pods for that Deployment, then creates the new pods.
Recreate causes downtime while old pods are terminated and new pods are created. Use it only when coexisting versions are unsafe or when brief downtime is acceptable.
Blue-Green Deployments and Canary Releases (advanced traffic control)
In addition to RollingUpdate and Recreate, blue-green and canary patterns offer more granular control over traffic and exposure:- Blue-Green: Maintain two separate environments (blue = current, green = new). Switch traffic to green once verified. This enables near-instant rollback by switching back to blue.
- Canary: Gradually shift a small percentage of user traffic to the new version, monitor behavior, then increase traffic in steps until fully rolled out.
Quick comparison
| Strategy | Downtime | Rollout control | Use case |
|---|---|---|---|
| RollingUpdate | Minimal/none | Incremental (maxSurge/maxUnavailable) | Stateless services, production web apps |
| Recreate | Yes (brief) | Simple (all at once) | Legacy/stateful apps that can’t run concurrently |
| Blue-Green | Minimal (switch moment) | Full environment swap | Safe testing in a production-like environment |
| Canary | Minimal | Fine-grained traffic shift | Gradual exposure, A/B testing, risk-limited deploys |
Recommended practices
- Use RollingUpdate for most stateless workloads.
- Configure readiness/liveness probes and
minReadySecondsto avoid routing traffic to unhealthy pods. - Use GitOps (Argo CD, Flux) to keep manifests declarative and reproducible.
- Employ blue-green or canary patterns for high-risk or business-critical changes; use service meshes for advanced traffic control.
- Automate monitoring and observability (metrics, tracing, logs) to detect regressions early during rollouts.
Links and references
- Kubernetes Deployments
- Kubernetes Rolling Update docs
- Argo CD (GitOps)
- Flux (GitOps)
- Blue/Green and Canary patterns overview (article)