Kubernetes Deployment Strategies: Rolling, Blue/Green and Canary
Kubernetes deployment strategies decide how a new version replaces the old one: how much traffic meets it first, how fast a bad release can be reversed, and what spare capacity the change consumes. This guide compares rolling updates, blue/green and canary releases with working YAML, rollback paths and the database rules that keep every strategy reversible.
Introduction
Kubernetes deployment strategies are the patterns that control how a new version of a workload replaces the old one, and Kubernetes ships two built in: RollingUpdate, the default, and Recreate. Blue/green and canary are patterns built on top with Services, Gateway API weights or rollout controllers.
This lesson opens Module 12 on delivery and GitOps. The previous lesson, Karpenter NodePool patterns, made capacity elastic; this one makes releases survivable. The pillar deployment reliability and canary releases goes deeper on canary analysis and release gates, while this guide covers strategy mechanics and selection. Readers new to Deployments should start with the first Kubernetes deployment lesson.
Consider an illustrative composite drawn from common production reviews, not a named incident. A team ships a routine change with the default rolling update. The new version carries a bug that only appears under real traffic shape, so staging stayed green. The rollout replaces Pods gradually, error rates climb gradually, and by the time alerts fire, every Pod runs the bad version. Rollback means another full rollout, ten more minutes of errors, and a database migration the old version cannot read. Nothing malfunctioned. The strategy simply never asked the new version to prove itself on a small slice of traffic first.
The 5-minute takeaway
Rolling updates suit most stateless releases and cost little spare capacity. Blue/green buys instant rollback with double capacity during the release. Canary buys the smallest blast radius with traffic weights and metric gates. Recreate fits only workloads that cannot run two versions at once. Database changes decide whether any rollback path is real.
1. Kubernetes deployment strategies: four axes decide the choice
Kubernetes deployment strategies differ along four axes: blast radius, rollback time, capacity overhead and version mixing. Every strategy is a position on those axes, and choosing one means deciding how many users a bad build may hurt before you notice, and how quickly traffic returns to the old version.
Blast radius measures exposure before the first health gate. Recreate and blue/green expose 100 percent of traffic at cutover; blue/green differs by validating the new fleet before the flip. Rolling updates expose one batch at a time, growing with each step. Canary exposes a chosen percentage, often 1 to 5 percent, and widens only while metrics stay healthy. Smaller blast radius costs either capacity, time or tooling; there is no free version.
Rollback time measures the path back. Blue/green flips a selector in seconds while the old fleet still runs. Canary sets a weight to zero in seconds. Rolling updates roll back by rolling forward to the previous ReplicaSet, which takes as long as the original rollout. Recreate redeploys from scratch. Teams consistently overvalue deploy speed and undervalue rollback speed, until the first bad release prices the difference.
Capacity overhead is the peak replica count relative to steady state. Recreate needs no spare capacity and pays with downtime. Rolling needs surge headroom. Blue/green needs a full second fleet. Canary needs the canary replicas plus stable capacity. Version mixing asks whether old and new code run side by side against the same data, which rolling and canary require and blue/green avoids at the traffic layer while still sharing the database.
Write the four numbers down per service before choosing. A payments API with strict error budgets buys canary. An internal tool with ten users buys rolling and spends the saved effort elsewhere. Strategy selection is a risk budget decision, and the budget belongs to the service owner, not to habit.
2. Kubernetes deployment strategies: rolling updates and their two knobs
Kubernetes deployment strategies start with RollingUpdate, the built-in default, which replaces Pods in batches bounded by maxSurge and maxUnavailable. maxSurge caps extra Pods above the desired count; maxUnavailable caps Pods allowed down during the rollout. Both default to 25 percent, and both accept absolute numbers.
maxUnavailable 0 with maxSurge 2 is the zero-downtime shape for small services: new Pods must become ready before old ones leave, and capacity only grows during the rollout. The cost is surge headroom the scheduler must place, which connects rollout settings to node capacity. A rollout that stalls with Pending surge Pods is a capacity problem wearing a deployment costume.
Percentages round in ways that surprise small replica counts. maxUnavailable 25 percent of 3 replicas rounds down to 0, so the rollout proceeds one surge Pod at a time; maxSurge 25 percent rounds up to 1. For services under ten replicas, absolute numbers state intent more honestly than percentages. For large fleets, percentages keep rollout duration roughly constant as the fleet grows.
Rolling updates mix versions by design. During the rollout, old and new Pods serve traffic simultaneously behind one Service, so APIs, message formats and database schemas must tolerate both versions at once. That constraint, not the YAML, is what rules rolling out for some changes. Section 10 covers the database discipline that keeps mixed-version periods safe.
Rollout duration follows from the knobs and Pod readiness time. Ten replicas with maxSurge 2 and 30-second readiness take roughly three minutes if batches proceed cleanly. progressDeadlineSeconds bounds how long the Deployment waits before marking the rollout failed, and a stalled rollout that nobody alerts on is worse than a failed one. Alert on rollout progress, not only on errors.
3. Kubernetes deployment strategies: readiness decides whether rolling is safe
Kubernetes deployment strategies rely on readiness probes to know when a new Pod may take traffic, and a rolling update is only as safe as those probes are honest. A probe that passes before the application can serve turns every strategy into a traffic drop with extra steps.
Readiness and liveness answer different questions. Readiness gates traffic: a Pod that fails readiness leaves Service endpoints but keeps running. Liveness restarts a wedged process. A rollout advances when new Pods pass readiness, so the readiness check must cover real serving ability: dependencies reachable, caches warm enough, migrations applied. A TCP check on the port proves the process listens, nothing more.
minReadySeconds adds a soak period: a Pod must stay ready for that long before the rollout counts it available and removes an old Pod. Thirty to sixty seconds catches crash-on-first-request bugs that a single successful probe misses. The cost is slower rollouts, which is the correct trade for services whose failures appear under load rather than at startup.
PodDisruptionBudgets interact with rollouts in both directions. A PDB that requires all replicas available blocks voluntary evictions, including the deletions a rolling update performs through its own controller logic in some paths and node drains in others. Size PDBs for node maintenance reality, typically maxUnavailable 1 for small services, and test a rollout against the PDB before assuming they compose.
Termination behaviour completes the picture. Old Pods receive SIGTERM and must drain in-flight requests inside terminationGracePeriodSeconds while endpoints remove them. Applications that exit instantly drop requests on every rollout, and the error graph blames the new version. Graceful shutdown is a deployment-strategy prerequisite, not an application nicety, and it is testable: watch error rates during a no-op rollout of the same image.
4. Kubernetes deployment strategies: Recreate, the honest downtime option
Kubernetes deployment strategies include Recreate, which deletes every old Pod before starting new ones, accepting downtime equal to startup time. It fits workloads that cannot run two versions against the same state, and environments where brief downtime costs less than the machinery that avoids it.
Recreate earns its place in narrow cases. A worker that holds an exclusive lock or a single-writer file format cannot overlap versions. A development environment values simplicity over availability. A batch job between runs has no traffic to protect. In each case the downtime is a chosen, bounded cost rather than an accident, and the strategy states it plainly in YAML.
The failure mode is using Recreate by accident: a Deployment with replicas 1 and default rolling settings still causes a brief gap when the single Pod is replaced without surge capacity, which is Recreate behaviour without the honest label. Single-replica services that matter need maxSurge 1 and maxUnavailable 0, or a second replica. Availability claims should be read from the strategy block, not from intentions.
Rollback under Recreate is a redeploy, with downtime again. That makes Recreate the weakest strategy for anything user-facing, and the right one only where version mixing is genuinely impossible. When a team reaches for Recreate because rolling updates keep breaking, the real problem usually sits in readiness probes or schema compatibility, and fixing those restores every other strategy as an option.
5. Kubernetes deployment strategies: blue/green with a Service selector flip
Kubernetes deployment strategies implement blue/green by running two complete Deployments, blue for the live version and green for the candidate, behind one Service whose selector chooses the active colour. Cutover and rollback are the same one-line selector change, applied in opposite directions.
The workflow has four steps. Deploy green alongside blue with its own version label. Validate green out of band: smoke tests through a preview Service or direct Pod access, synthetic traffic, dependency checks. Flip the Service selector to green. Keep blue running through a soak window, then scale it down. The validation step is where blue/green earns its cost, because the new version meets production dependencies before it meets production users.
Selector flips are fast but not magic. Endpoint propagation takes seconds, existing connections drain on their own schedule, and clients with long-lived connections keep talking to blue until they reconnect. For HTTP services behind a load balancer the flip feels instant. For connection-heavy protocols, plan drain behaviour explicitly or the cutover smears across minutes.
Blue/green with two Deployments needs label discipline. Both Deployments share the app label and differ by version label; the Service selector must include the version label or traffic splits across colours by accident, which is an unplanned canary with no gates. Preview access for green needs its own Service or Ingress rule that production traffic cannot reach. Controllers such as Argo Rollouts automate this pattern with preview services and promotion steps, which is worth adopting once blue/green becomes routine rather than occasional.
6. Kubernetes deployment strategies: blue/green costs and database limits
Kubernetes deployment strategies price blue/green at roughly double capacity during the release window, plus the operational cost of running two fleets against shared dependencies. The instant rollback is real, and so is the bill; both belong in the decision every single time.
Capacity is the visible cost. Green needs a full replica set before cutover, so the cluster must schedule 2x Pods for the service, and node autoscaling must have headroom or quota to do it. Short release windows keep the cost small; a blue fleet kept for a week of soak is a week of double spend. Set the soak window from error-detection time, not from caution, and automate blue scale-down so the window cannot silently extend.
The database is the invisible limit. Blue and green share one database, so green's schema changes must remain readable by blue for rollback to mean anything. A green release that migrates the schema destructively converts instant rollback into a restore-from-backup incident. Blue/green protects the compute layer completely and the data layer not at all, which is why section 10's expand-and-contract discipline applies with full force here.
Stateful side effects need the same scrutiny. Background jobs, queue consumers and schedulers running in both colours can double-process work during the overlap. Run singleton components in one colour only, gate them by leader election, or accept and design for duplicate delivery. The cutover checklist should name every component that must exist exactly once, because blue/green duplicates everything else by default.
Blue/green fits best where releases are infrequent, validation before traffic matters, and rollback speed dominates the risk budget: regulated changes, risky dependency upgrades, services whose errors are expensive per minute. For high-frequency deploys, the double-capacity cost and manual promotion steps push teams toward canary automation instead.
7. Kubernetes deployment strategies: canary by replica ratio, the coarse version
Kubernetes deployment strategies implement a basic canary by running a small canary Deployment beside the stable one behind a shared Service, so traffic splits roughly by replica ratio. One canary Pod among ten total receives about 10 percent of requests, with no extra tooling required.
The mechanics are plain. Stable runs 9 replicas labelled version stable; canary runs 1 replica labelled version canary; the Service selector matches the shared app label only, so endpoints include both. Promote by scaling canary up and stable down in steps; roll back by scaling canary to zero. Every step is a replica change, which makes the pattern easy to run by hand and easy to automate badly.
Coarseness is the honest limitation. Replica ratios quantise traffic: with 4 total Pods the smallest canary step is 25 percent, which is a large blast radius for a risky change. Load balancing across endpoints is roughly even per connection, not exact per request, so the canary share wobbles. Header-based routing, per-user targeting and precise percentages are unavailable. For small services and low-risk changes, coarse canary still beats blind rolling, because 25 percent exposure with a fast scale-to-zero beats 100 percent exposure discovered by alert.
Canary analysis needs comparable signals. Error rate and latency must be measurable per version, which means metrics labelled by version or Pod, dashboards that split stable against canary, and thresholds decided before the release. A canary nobody watches is a rolling update with extra YAML. The deployment reliability pillar covers analysis depth; the minimum viable version is an error-rate comparison with a pre-agreed abort threshold.
Keep canary windows short and decisive. A canary that runs for days at 10 percent accumulates version-mixing risk while teaching little new. Steps of 5, 25, 50 and 100 percent with a metric check at each step complete most releases inside an hour. If traffic is too low for statistical confidence at small percentages, that fact argues for blue/green validation instead, not for a longer canary.
8. Kubernetes deployment strategies: canary with weights and rollout controllers
Kubernetes deployment strategies reach precise canary control through traffic weights: Gateway API HTTPRoute backendRefs split requests by weight between stable and canary Services, and controllers such as Argo Rollouts or Flagger automate promotion and rollback decisions from metric analysis results.
Weights decouple traffic share from replica count. The canary can run 2 replicas for resilience while receiving 1 percent of traffic, or run at full replica count while receiving 50 percent. Header matches on the same route enable internal testing before any percentage shifts. The Gateway API tutorial covers the objects; the strategy point is that weights make exposure a dial instead of a replica side effect.
Rollout controllers close the loop. Argo Rollouts replaces the Deployment with a Rollout resource that steps weights, pauses for analysis, and aborts on failed metric checks. Flagger drives similar promotion around existing Deployments and ingress or mesh traffic shifting. Either way, the promotion decision moves from a human watching dashboards to a query with thresholds, which is what makes canary sustainable at high deploy frequency.
Automation raises the bar on metric quality. An analysis query that flaps aborts good releases; one that never fires promotes bad ones. Test analysis templates against historical incidents before trusting them with production traffic, and keep a manual abort path that any on-call engineer can execute without controller expertise. Progressive delivery reduces blast radius only when its gates measure user impact, not proxy comfort.
Service meshes offer the same weight mechanics with richer telemetry, at the cost of running the mesh. Gateway API weights cover most HTTP canary needs without that commitment. Choose the lightest mechanism that gives exact percentages and per-version metrics, because traffic machinery is itself production infrastructure with failure modes.
9. Kubernetes deployment strategies: rollback paths, compared honestly
Kubernetes deployment strategies differ most under pressure, in how traffic returns to the old version. Rolling rollback re-rolls, blue/green flips a selector, canary zeroes a weight, and Recreate redeploys. Rollback time, not deploy time, is the number that prices a bad release.
| Strategy | Rollback action | Typical rollback time | Rollback precondition |
|---|---|---|---|
| RollingUpdate | kubectl rollout undo | Minutes, a full re-roll | Previous ReplicaSet retained |
| Recreate | Redeploy previous version | Minutes plus downtime | Previous image available |
| Blue/green | Flip Service selector back | Seconds | Blue fleet still running |
| Canary (weights) | Set canary weight to 0 | Seconds | Stable fleet untouched |
Rolling rollback deserves one precise note. kubectl rollout undo returns the Deployment to the previous ReplicaSet, which then rolls out with the same maxSurge and maxUnavailable rules. It is reliable and slow in proportion to fleet size and readiness time. Revision history limits how far back undo reaches, so revisionHistoryLimit is a rollback setting, not housekeeping.
Blue/green and canary rollbacks are fast because the old version never left. That speed evaporates when the release changed data irreversibly, which is why rollback preconditions belong in the release checklist: old fleet running, schema backward compatible, feature flags able to disable new behaviour without a deploy. Feature flags decouple release from exposure and give every strategy a second, faster rollback lever for behaviour changes.
Practise rollback before needing it. A quarterly game day that rolls back a staging release with the production procedure finds the missing permission, the stale runbook and the dashboard nobody can read. Rollback paths that exist only in documentation fail at the same rate as backups that were never restored.
10. Kubernetes deployment strategies: database changes decide reversibility
Kubernetes deployment strategies stay reversible only when database changes follow expand-and-contract: add new structures compatibly, migrate data, switch reads and writes, and remove old structures in a later release. Destructive migrations in the same release as code changes convert every strategy's rollback into a data restore.
The sequence has four releases, or four phases within a release train. Expand: add the new column or table, nullable and unused. Migrate: backfill data and dual-write where needed. Contract reads: move code to the new structure while old code could still run. Contract schema: drop the old structure only after the previous version is beyond rollback reach. Each phase keeps old and new code runnable against the schema, which is the precondition rolling and canary version mixing already demands.
Migration execution needs its own care. Run schema changes as Jobs or init steps with locking discipline, keep them backward compatible with the currently running version, and never let application startup race migrations across replicas. A rolling update where new Pods migrate while old Pods still serve is the classic self-inflicted outage, and it is entirely preventable by separating migration releases from code releases.
Feature flags and schema phases compose. Ship code that reads both structures behind a flag, flip the flag as the canary step, and roll back by flipping it back while the schema stays expanded. The flag flip is faster than any traffic mechanism and works even where weights do not. Flags accumulate, though; a flag without a removal date becomes permanent version mixing in code form.
Data rollback has one honest answer: restore from backup, with data loss bounded by backup and replication lag. Strategies cannot repeal that. What they can do is ensure the restore path is never the plan, by keeping schema changes compatible until the release is proven. Release checklists should ask one question verbatim: can the previous version run against the schema this release leaves behind?
11. Kubernetes deployment strategies: choosing per service, then automating
Kubernetes deployment strategies should be chosen per service from its risk budget, then automated through the same GitOps path that delivers every other change. The table below maps common service profiles to a default strategy, with the understanding that database compatibility gates all of them.
| Service profile | Default strategy | Reason |
|---|---|---|
| Stateless API, frequent deploys | RollingUpdate, maxUnavailable 0 | Cheap, adequate, version mixing tolerated |
| High-traffic service, expensive errors | Canary with weights and analysis | Smallest blast radius, metric-gated promotion |
| Infrequent risky change, fast rollback needed | Blue/green | Validate before traffic, instant selector rollback |
| Single-writer or lock-holding workload | Recreate or blue/green with singleton care | Two versions must not run at once |
| StatefulSet workload | RollingUpdate with partition care | Ordered Pod replacement; see controller guide |
Stateful workloads bend every rule. StatefulSet rolling updates replace Pods in ordinal order and support partitions for staged updates, which is a canary-like mechanism native to the controller. The Deployment vs StatefulSet vs DaemonSet guide covers controller choice; the strategy point is that stateful releases need ordering and data-safety analysis before traffic tricks.
GitOps delivery makes strategy changes reviewable. The strategy block, weights and rollout steps live in Git, so a release is a reviewed diff and rollback is a revert. The GitOps best practices guide covers that pipeline discipline, and the next lesson covers packaging the manifests themselves. What GitOps must not do is fight the rollout controller: one system owns replica and weight changes during a release, or sync loops will undo promotion steps.
Standardise the defaults, then allow documented exceptions. A platform that offers rolling as the paved road, canary automation for services that opt in, and blue/green runbooks for exceptional changes gets consistency without forcing every team into the heaviest machinery. Exceptions should name the risk that justifies them, in the service's own documentation, where the next on-call engineer will find it.
12. Kubernetes deployment strategies: troubleshooting matrix and checklist
Kubernetes deployment strategies fail in recognisable ways: rollouts stall on capacity or probes, canaries promote on bad metrics, and rollbacks discover schema incompatibility. The matrix below maps symptoms to first checks, and the checklist turns strategy selection into a release review.
| Symptom | First check | Likely cause | Fix direction |
|---|---|---|---|
| Rollout stuck, Pods Pending | Surge Pod events | No node capacity or quota for surge | Add capacity; lower maxSurge |
| Rollout stuck, Pods not ready | Readiness probe results | Probe stricter than real health, or app not serving | Fix probe or startup path |
| Errors spike during rollout | Per-version error split | New version bug under real traffic | Roll back; add canary gate |
| Rollback takes as long as deploy | Strategy in use | Rolling rollback re-rolls by design | Move risky services to canary or blue/green |
| Blue/green flip, errors continue | Schema compatibility | Green migrated destructively | Expand-and-contract; restore if needed |
| Canary promotes bad release | Analysis query history | Gate measures proxy, not user impact | Rebuild gate from error and latency SLOs |
Production checklist
- The strategy per service is chosen from blast radius, rollback time, capacity overhead and version mixing, and written down.
- Rolling updates set maxUnavailable 0 for user-facing services, with surge capacity the cluster can actually schedule.
- Readiness probes prove serving ability, minReadySeconds soaks new Pods, and graceful shutdown drains in-flight requests.
- Blue/green keeps the old fleet through a defined soak window, with singleton components handled explicitly.
- Canary steps carry pre-agreed error and latency thresholds, measured per version, with a manual abort anyone can run.
- Rollback has been practised: rollout undo, selector flip or weight zero, whichever the strategy promises.
- Database changes follow expand-and-contract, and the previous version can run against the schema each release leaves.
- Feature flags carry removal dates, and strategy changes land through reviewed GitOps diffs.
Release safety is mostly decided before the deploy starts: honest probes, compatible schemas, bounded exposure and a rollback path that has been exercised. Kubernetes deployment strategies give four ways to bound exposure; the engineering is choosing per service and proving the exit works. From here, Module 12 on delivery and GitOps continues to packaging with Helm and Kustomize in GitOps pipelines, because strategies need manifests that render the same way in every environment.
Frequently Asked Questions
Which of the Kubernetes deployment strategies has zero downtime?
Rolling updates with maxUnavailable 0, blue/green and canary all avoid downtime in Kubernetes deployment strategies, provided readiness probes are honest and surge capacity exists. Recreate accepts downtime by design. Zero downtime describes traffic continuity, not safety: a rolling update can still deliver a bad version to every user gradually.
How do Kubernetes deployment strategies implement blue/green?
Kubernetes deployment strategies implement blue/green with two Deployments labelled by version behind one Service. The Service selector points at blue while green deploys and validates, then flips to green for cutover. Rollback flips the selector back while blue still runs, which is why the soak window matters.
Can Kubernetes deployment strategies run a canary without a service mesh?
Yes. Kubernetes deployment strategies can run canary releases with replica ratios behind a shared Service, or precisely with Gateway API HTTPRoute weights between stable and canary Services. A mesh adds telemetry and header routing, but exact percentages and per-version metrics are achievable without one.
Why does rollback take so long in Kubernetes deployment strategies with rolling updates?
Rolling rollback re-rolls the previous ReplicaSet under the same maxSurge and maxUnavailable rules, so Kubernetes deployment strategies based on RollingUpdate reverse at rollout speed. Blue/green and canary roll back in seconds because the old version never stopped running. Rollback time should be priced when choosing a strategy.
What breaks Kubernetes deployment strategies during database migrations?
Destructive schema changes break rollback in all Kubernetes deployment strategies, because the old version cannot run against the new schema. Expand-and-contract migrations keep both versions runnable: add structures compatibly, migrate data, switch code, and drop old structures only after rollback is no longer needed.
When should Kubernetes deployment strategies use Recreate?
Kubernetes deployment strategies use Recreate when two versions must never run at once, such as single-writer workloads holding exclusive locks, or in environments where brief downtime costs less than avoidance machinery. For user-facing services, Recreate is usually a sign that probes or schema compatibility need fixing instead.
How do Argo Rollouts and Flagger change Kubernetes deployment strategies?
Argo Rollouts and Flagger automate canary and blue/green promotion in Kubernetes deployment strategies, stepping traffic weights and aborting on metric analysis. They replace manual replica scaling and dashboard watching with threshold queries. The gates must measure user impact, and a manual abort path should remain available.
Preparing for Senior Platform & SRE Interviews
Practice real-world cluster triage, RBAC debugging, and pod scheduling scenarios in our Kubernetes scenario interview questions hub.
Explore Interview Scenarios →