TL;DR
Learn about different deployment strategies in Kubernetes, including rolling updates, blue-green deployments, and canary releases, with practical examples and best practices.
Executive Summary
How you release is as consequential as what you release. Kubernetes gives you a built-in rolling update, and, with additional structure or tooling, recreate, blue-green, and canary strategies that trade resources, speed, and risk in different proportions. This guide explains how each strategy actually behaves at the pod and traffic level, what it requires from your application in terms of backward compatibility and health signalling, and how rollback works in each case. You will finish able to choose a strategy per service based on its risk profile and traffic, rather than applying one pattern to everything, and able to recognise when the limiting factor is not the strategy but the database change underneath it.
Why This Matters
Most production incidents are change-induced, and deployment is the change you make most often. A strategy that replaces every pod at once turns a bad release into an outage. A strategy that shifts traffic gradually turns the same bad release into a small, observable error budget event with a fast retreat. The cost of getting this wrong is not only downtime; it is the team's willingness to deploy at all. Organisations with painful releases batch changes into larger, rarer, riskier releases, which makes each incident bigger and rarer deployments feel justified. Choosing and rehearsing a deployment strategy is how that cycle is broken: small releases, limited blast radius, and a rollback that has been performed before it is needed.
Core Concepts
Rolling Updates: The Built-In Default
A deployment's default strategy replaces pods gradually: a new ReplicaSet scales up while the old one scales down, bounded by two settings. Max surge controls how many extra pods may exist above the desired count during the rollout; max unavailable controls how many pods may be down relative to the desired count.
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
template:
spec:
containers:
- name: app
image: myapp:v2New pods only receive traffic once their readiness probe passes, which is why an honest readiness probe is part of the deployment strategy and not an optional extra. Rollout status is observable, pausable, and reversible: kubectl rollout status reports progress, and rollout undo returns to the previous ReplicaSet. The limits of the built-in strategy are equally important. Traffic shifts in proportion to pod counts, not by precise percentage; there is no automatic analysis of error rates; and both versions serve production simultaneously during the rollout, so the new version must be backward compatible with the old one's data and APIs for at least one release cycle. For most stateless services, most of the time, those limits are acceptable and rolling update is the correct default.
Recreate: Simple, with Downtime
The recreate strategy terminates all old pods before starting new ones. It guarantees that two versions never run simultaneously, which a small class of applications requires: workers that must not process the same job twice, applications with exclusive locks, or migrations that cannot tolerate mixed versions. The price is downtime proportional to startup time. Choose it deliberately for those cases and for development environments, never as an unexamined default for user-facing services.
Blue-Green: Two Environments, One Switch
Blue-green runs the new version as a complete, separate deployment alongside the current one. When the new environment is verified, a service selector change moves all traffic to it at once.
# Service for blue environment
apiVersion: v1
kind: Service
metadata:
name: my-app
labels:
app: my-app
spec:
selector:
app: my-app
version: v1 # Switch between v1 and v2
ports:
- port: 80The switch is fast and total, and rollback is the same switch in reverse, which is the strategy's real appeal: the old environment stays running, untouched, until you choose to retire it. The costs are structural. You need capacity for two full environments during the change, verification must happen without production traffic, through smoke tests or mirrored traffic, and shared state is the hard part: if the new version migrates a shared database, switching traffic back does not un-migrate the data. Blue-green suits critical services where instant, complete rollback is worth double capacity, and where the data layer changes are backward compatible or separately managed.
Canary: Gradual Traffic with Evidence
A canary release sends a small, controlled share of real traffic to the new version, watches error rates and latency against the stable version, and promotes or retreats based on that evidence. Plain Kubernetes approximates this with two deployments behind one service, where replica proportions roughly determine traffic share, which is coarse and changes with scaling. Precise canary requires traffic control at an ingress or service mesh layer, where weights are explicit.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-app-vs
spec:
hosts:
- my-app
http:
- route:
- destination:
host: my-app-stable
subset: v1
weight: 90
- destination:
host: my-app-canary
subset: v2
weight: 10
In practice, teams that canary seriously use a progressive delivery controller such as Argo Rollouts or Flagger, which automates the weight steps, queries metrics providers, and rolls back without a human watching a dashboard at midnight. The prerequisites are non-negotiable: comparable metrics for both versions, a defined promotion threshold, and an automatic halt. A canary without analysis is just a slow rolling update with extra components.
The Compatibility Constraint Under Every Strategy
Every strategy except recreate runs two versions at once, so the release must tolerate that. Practically, this means expand-and-contract data changes: add the new column or field first, deploy code that works with both shapes, then remove the old shape in a later release. It means APIs keep old fields and behaviours for one cycle, and consumers and producers are deployed in an order that never pairs incompatible versions. When a change cannot be made backward compatible, no deployment strategy makes it safe; the answer is a feature flag that decouples deployment from release, a maintenance window accepted openly, or a redesign of the change into compatible steps.
Health Signals and Rollback Discipline
Strategies execute on signals, so signal quality decides release quality. Readiness probes gate traffic to new pods and must reflect real ability to serve, not merely process liveness. Rollout progress deadlines turn a stuck deployment into an explicit failure instead of a silent half-state. Rollback should be a single rehearsed action, returning to the previous ReplicaSet or traffic weights, and the team should know in advance which signal triggers it: error rate, latency, a business metric, or a failed smoke test. An untested rollback is a hypothesis, and incidents are a bad time to run experiments.
Decision Framework
| Situation | Recommendation |
|---|---|
| Standard stateless service, backward-compatible change | Rolling update with considered surge and unavailability settings |
| Critical service where instant full rollback is the priority | Blue-green, with the old environment kept until the new one is proven |
| High-traffic service where a bad release must affect as few users as possible | Canary with weighted traffic, metric analysis, and automatic rollback via a progressive delivery controller |
| Application that cannot run two versions at once | Recreate, scheduled and communicated, or redesign the change for compatibility |
| Change is risky but the code is ready before the feature should be visible | Deploy dark behind a feature flag, then release by flag, independent of pod strategy |
| Database schema change | Expand-and-contract across releases; no pod strategy substitutes for it |
| Rollback has never been tested | Fix that before adopting any advanced strategy |
Implementation Checklist
Trade-offs
Rolling updates are economical and simple, and give coarse traffic control with no built-in analysis. Blue-green buys the fastest, cleanest rollback at the price of double capacity and pre-production verification that can miss traffic-dependent faults. Canary gives the smallest blast radius and the best evidence, at the price of the most machinery: traffic control, comparable metrics, and analysis automation. Recreate is the simplest to reason about and the only one with guaranteed downtime. Underneath all of them, the compatibility work, probes, metrics, and rehearsed rollback, costs effort on every release, which is precisely the effort that makes frequent releases safe.
When Not to Use
Do not reach for blue-green or canary tooling for low-traffic internal tools where a rolling update and a fast rollback already limit harm to near zero; the machinery will cost more attention than the risk it removes. Do not use any progressive strategy to compensate for a change that is not backward compatible; fix the change. Do not canary a release whose versions cannot be compared, for example when the new version changes the metrics themselves, because the analysis will certify noise. And do not deploy stateful systems with exclusive storage or leader election using patterns designed for stateless replicas; those workloads need their own upgrade discipline, usually ordered, one member at a time, under the operator or StatefulSet semantics built for them.
Conclusion
Start with rolling updates done properly: honest probes, deliberate surge settings, compatible changes, and a rehearsed rollback. Graduate to blue-green where instant retreat is worth double capacity, and to canary where traffic volume makes gradual, evidence-based promotion worth its machinery. The strategy is the visible part; compatibility and signals are what make any of them safe.
References
Why This Matters
Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.
Trade-offs to Consider
Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.
When NOT to Use This
Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.
Decision Framework
Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.