LOOP · The DevOps Codex
Ch 05 · Deployment Strategies
Chapter 05 · The Last Mile

Deployment Strategies — how the new artefact reaches users without breaking them

A deploy is the act of placing an artefact on production hosts; a release is the moment users see its behaviour. The strategies in this chapter — Rolling, Blue-Green, Canary, Shadow, Ring-based and friends — exist to bend that distinction in your favour. Choose well and a regression touches twenty users for forty seconds. Choose badly and it touches every user for forty minutes.

5.1 · Why deploy strategy matters

Definition. A deployment strategy is the orchestrated process by which a new version of software replaces or coexists with the previous version in a production environment. It governs the order of host updates, the routing of traffic, the gating signals that promote or abort, and the path back to safety if something goes wrong.

TermDefinitionOwner
DeployThe artefact (image, binary, bundle) is installed on production infrastructure.Pipeline / GitOps controller.
ReleaseThe new behaviour becomes visible to (some) users.Traffic router, feature flag, store rollout.
RolloutThe choreography of moving from 0% → 100% release.Progressive-delivery controller (Argo Rollouts, Flagger).
RollbackReverting to the previous known-good state.Automatic on SLO breach, or human-triggered.
Separate deploy from release. Once you can ship code to production without exposing it, every other strategy in this chapter becomes a tuning knob rather than a heroic effort. Feature flags (Ch 06) are the cleanest separator.

5.2 · The strategy catalogue

StrategyMechanismInfra costBlast radiusRollbackTypical use
RecreateStop v1, start v2.1×100% during gapRe-deploy v1Dev, batch, schema-locked apps.
RollingReplace instances in waves.~1.1×Wave-sizedRoll forward / pauseK8s default; stateless services.
Blue-GreenRun v2 alongside v1; flip LB.2×0% or 100% (flip)Flip backCritical workloads needing instant revert.
CanaryRoute a small % of traffic to v2; widen on green metrics.1.05–1.2×Canary slice onlyDrop weight to 0User-facing services with SLOs.
Linear / SteppedCanary with fixed steps (10, 25, 50, 100%).1.1×Step-sizedDrop weightPredictable, audit-friendly canaries (AWS CodeDeploy).
A/BRoute by user attribute (cohort, geo) to compare variants.~1.2×Cohort-sizedTurn off variantProduct experiments, not safety.
Shadow / MirrorCopy live requests to v2; discard responses.~2×0% user-visibleStop mirrorReplatform, perf validation.
Dark LaunchCode deployed, behaviour hidden behind a flag.1×0% until flipDisable flagPre-launch warm-up, schema seeding.
Ring-basedCohorts of clusters/users updated in concentric rings.1.1×Ring-sizedHalt at ringFleet-wide SaaS (M365, Windows).
Multi-variant CanarySeveral candidate versions canaried in parallel.1.3–2×Slice-sizedPick winnerML model rollouts, perf bake-offs.

5.3 · Rolling deployments

Definition. A rolling deployment replaces a service's instances in successive waves, draining and updating a controlled number at a time while the rest continue to serve traffic. It is the Kubernetes Deployment default.

  • maxSurge — extra pods above the desired count that may exist during the roll (e.g. 25%). Higher = faster, more capacity needed.
  • maxUnavailable — pods that may be down at once (e.g. 0 for zero-downtime services on autoscaled nodes).
  • Readiness probes — gate traffic to a pod only after the new version reports healthy.
  • minReadySeconds — soak the pod for N seconds before counting it ready (catches slow-start crashes).
  • PodDisruptionBudget — caps simultaneous voluntary disruptions during the roll.
# Kubernetes Deployment — safe rolling defaults
spec:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 0
  minReadySeconds: 15
  progressDeadlineSeconds: 600   # auto-fail if stuck
Rolling does not guarantee correctness — it guarantees gradual replacement. If v2 has a bug, the bug rolls out too. Pair rolling with health gates or upgrade to Canary.

5.4 · Blue-Green

Definition. Two complete production stacks (blue = current, green = candidate) run side by side. A load-balancer, DNS record, or service-selector switch promotes green to live in one atomic flip; the previous stack remains warm for instant rollback.

Users Load Balancerflip → green BLUE · v1live → standby GREEN · v2standby → live
  • Pros. Instant rollback by flipping back; full validation against production-grade infra; no two versions on a single host.
  • Cons. Doubled capacity cost during the cutover window; database migrations and stateful systems complicate the symmetry.
  • Implementations. AWS Elastic Beanstalk swap-URL, AWS CodeDeploy ECS/Lambda blue-green, Azure Deployment Slots, Cloudflare DNS swap, K8s Service selector flip.

5.5 · Canary

Definition. A canary deployment routes a small fraction of live traffic to a new version, observes SLO-grade signals (latency, error rate, saturation, business KPIs), and progressively widens — or rolls back — based on automated analysis.

PhaseWeightActionGate
Bake1–5%Warm caches, JIT, connection poolsNo 5xx in 2 min
Step 110%Compare error/latency vs baselinep99 within 10%
Step 225%Watch business metric (orders/min)Δ within 1σ
Step 350%Confirm steady stateSLO budget intact
Promote100%Scale down old; flip stable label—
# Argo Rollouts — analysis-gated canary
spec:
  strategy:
    canary:
      steps:
      - setWeight: 10
      - pause: { duration: 2m }
      - analysis:
          templates: [{ templateName: success-rate }]
      - setWeight: 50
      - pause: { duration: 10m }
---
kind: AnalysisTemplate
metrics:
- name: error-rate
  successCondition: result[0] < 0.01
  provider:
    prometheus:
      query: sum(rate(http_requests_total{status=~"5..",svc="checkout-canary"}[2m]))
            / sum(rate(http_requests_total{svc="checkout-canary"}[2m]))
  • Argo Rollouts (Intuit, CNCF Incubating) — Rollout CRD replaces Deployment; integrates with Istio, Linkerd, NGINX, ALB, AppMesh, SMI.
  • Flagger (Flux project, CNCF) — Operator-driven canaries with Prometheus, Datadog, Dynatrace, NewRelic, CloudWatch, Stackdriver, Graphite as metric providers.
  • Spinnaker Kayenta — Netflix's Automated Canary Analysis (ACA) service, scoring via Mann-Whitney U tests.

5.6 · Shadow / Traffic Mirroring

Definition. Shadow deployment forwards a copy of live production requests to a candidate service, discarding its responses. The user sees only the production answer; the candidate is observed for crashes, latency, and divergence.

  • Service mesh primitives. Istio mirror/mirrorPercentage, Linkerd traffic split + tap, Envoy request_mirror_policies, NGINX mirror.
  • Best for. Replatform (Java → Go), datastore swap (MySQL → Postgres), model A/B comparison, infrastructure migrations.
  • Hazards. Side effects! If the candidate writes to real databases, sends emails, or charges cards, shadow becomes not-shadow. Always route writes to a sandbox or use idempotency keys with a sink.

5.7 · Ring-based deployment

Definition. Pioneered at scale by Microsoft for Office 365 and Windows (and documented in the Azure Well-Architected Framework, 2018+), ring-based deployment treats the fleet as concentric cohorts: each ring proves the build before the next opens. A bad change is contained at the smallest ring affected.

RingCohortSoakPurpose
Ring 0 · CanaryDogfood / internal tenants1–4 hoursCatch crashes, smoke
Ring 1 · Early AdopterSmall external preview tenants1–3 daysReal-traffic regressions
Ring 2 · Broad~25% of fleet3–7 daysScale & long-tail bugs
Ring 3 · PublicRemaining 100%Steady stateGA
Ring-based ≠ Canary. Canary is per-deploy traffic splitting; rings are per-tenant/cluster cohorts that persist across releases. A SaaS often uses both: ring assignment selects the cluster, canary selects the % within it.

5.8 · The 2026 deployment-tooling landscape

ToolVendorBest at
Argo RolloutsCNCF (Intuit)K8s canary/blue-green with rich analysis.
FlaggerCNCF (Flux)GitOps-native progressive delivery on K8s.
SpinnakerCDF (Netflix)Multi-cloud pipelines, Kayenta ACA.
Harness CDHarnessAI-assisted verification, hosted progressive delivery.
CodefreshOctopus / CodefreshGitOps + Argo Rollouts as a managed service.
Octopus DeployOctopusWindows / .NET / on-prem heterogeneous fleets.
AWS CodeDeployAWSEC2, Lambda, ECS canary/linear/blue-green.
Azure Deployment SlotsAzureApp Service blue-green with slot swap.
Google Cloud DeployGCPGKE/Cloud Run delivery pipelines with verification.
Kubernetes DeploymentK8s coreBuilt-in rolling updates.

5.9 · Database deployments

The single hardest part of any deployment strategy is the part that holds state. Schemas cannot be canaried trivially; you have one production database and it must serve both old and new code during the rollout.

  • Expand-and-contract (parallel change). Add the new column/table (expand) → backfill → switch reads → remove old (contract). Each step is backwards-compatible in isolation.
  • Dual writes. Application writes to both old and new schema during the migration window; reconciliation job verifies parity before flipping reads.
  • Online schema change. Tools that mutate large tables without locking — gh-ost (GitHub, MySQL), pt-online-schema-change (Percona Toolkit), Vitess online DDL, Atlas (Ariga), Spanner schema updates (online by design).
  • Versioned migration runners. Liquibase, Flyway, Sqitch, Alembic, Prisma Migrate, TypeORM migrations, golang-migrate — track applied changes via a metadata table.
  • Branching databases. Neon, PlanetScale, Xata — per-branch ephemeral DBs for CI; merge as a deploy primitive.
Never combine an application deploy with a destructive schema change in the same release window. If you must drop a column, deploy code that ignores it, wait a full release cycle, then drop it in a separate change. Rollback safety depends on it.

5.10 · Mobile & desktop releases

PlatformStaged rolloutReview windowOTA / hotfix
Google Play (Android)1% → 5% → 10% → 20% → 50% → 100% over daysHours to a dayIn-app updates API, Expo OTA (React Native), CodePush (deprecated 2024).
App Store Connect (iOS/macOS)Phased Release — 7-day automatic schedule24–48 h typicalExpo OTA for JS bundles; native code requires submission.
Microsoft StorePackage Flights to ring cohortsHoursMSIX delta updates.
Electron / Tauri desktopelectron-updater channels (alpha/beta/stable), SquirrelNoneAuto-update from signed feed.
SteamBranches (default, beta, internal)NoneDelta patches via Steampipe.
  • Force-update. Ship a minimum-supported-version endpoint; clients below it show a blocking update screen — critical for breaking API changes.
  • Server-driven UI. Move screen layout to a configuration service so design changes ship without a store submission.
  • Halt rollout. Both Play and App Store let you pause a staged rollout if crash-free-sessions drops.

5.11 · Rollback playbook

  1. Define automatic rollback triggers before the deploy — SLO error-budget burn, p99 latency > threshold, business-metric drop > X%.
  2. Make rollback the same primitive as deploy. If rollback is a different script, it will fail at 03:00. GitOps revert-PR is the gold standard.
  3. Keep the previous version warm for at least one full release cycle (blue stack standby, previous ReplicaSet retained, last image pinned).
  4. Prefer flag flip to redeploy when the change is flag-gated — seconds vs minutes.
  5. Database changes follow the contract, not the deploy. Roll back code; data stays expanded until the next planned contract.
  6. Post-incident. Every rollback yields a learning ticket and an updated playbook (see Ch 15).
Cross-references
  • Ch 04 — the pipeline that hands the artefact to the strategy.
  • Ch 06 — feature flags as the cleanest deploy/release separator.
  • Ch 07 — GitOps controllers (Argo CD, Flux) executing the rollout.
  • Ch 13 — SLO signals that gate canary promotion.
  • Ch 15 — rollback as the first action of incident response.

5.12 · Self-check

Q1 · Which strategy lets you flip back to the previous version in seconds at the cost of running double infrastructure during the cutover?
Rolling update
Blue-Green
Recreate
Shadow
Q2 · What is the safest database pattern to deploy a column rename alongside application code?
Drop the old column and add the new one in a single migration.
Expand-and-contract across multiple releases.
Mirror the database writes to a second cluster.
Skip the migration and patch in production.
Q3 · Why is a traffic-mirroring (shadow) deploy dangerous if the candidate service writes to the real production database?
It doubles read load and saturates the DB.
Mirrored writes become real side effects — duplicates, double-charges, real emails.
The mesh cannot mirror POST requests.
Latency on the live path increases proportionally.