Choosing between blue-green, canary, and rolling deployments is a risk and capacity decision, not simply a Kubernetes setting. This guide gives you a repeatable way to compare traffic control, infrastructure cost, database compatibility, observability needs, rollback speed, and operational complexity before a high-risk release.
Overview
A deployment strategy determines how a new version reaches users and what happens when its health signals deteriorate. The right choice depends on the service’s failure impact, traffic pattern, data model, platform capabilities, and the team’s ability to detect and reverse a bad release.
Blue-green deployment runs two production environments. One environment serves traffic while the other hosts the candidate version. Traffic moves to the candidate after validation. This provides a fast, relatively simple rollback, but it usually requires duplicate application capacity and careful handling of shared databases, queues, caches, and background workers.
Canary deployment sends a controlled portion of traffic to the new version before increasing exposure. A canary can be based on percentage, headers, user groups, geography, or another routing rule. It limits the blast radius, but it requires trustworthy telemetry and a mechanism for changing traffic without introducing inconsistent behavior.
Rolling deployment replaces instances or pods in batches. It avoids maintaining two complete environments and is widely supported by container orchestrators, but old and new versions coexist during the rollout. That makes backward-compatible APIs, schema changes, readiness checks, and connection draining especially important.
| Criterion | Blue-green | Canary | Rolling |
|---|---|---|---|
| Traffic control | Fast switch between environments | Fine-grained progressive exposure | Indirect, based on replacement batches |
| Infrastructure cost | Higher during overlap | Variable; needs candidate capacity and routing | Usually lower, with temporary overlap |
| Database compatibility | Requires a safe transition between versions | Requires old and new versions to coexist | Strong backward compatibility is usually needed |
| Observability requirements | Baseline and candidate comparison | Detailed segmented metrics and alerts | Rollout health and aggregate service metrics |
| Rollback speed | Fast if the previous environment remains ready | Fast if traffic can be reduced or reversed | Depends on batch progress and image availability |
| Operational complexity | Moderate | Moderate to high | Low to moderate |
How to estimate the best-fit strategy
Start with a simple decision score rather than choosing by habit. Rate each factor from 1 to 5 for the service, where 1 is low and 5 is high:
- Impact of failure: How damaging would a bad release be?
- Traffic uncertainty: How difficult is it to predict real production behavior?
- Rollback urgency: How quickly must the team restore the previous version?
- Observability maturity: Can the team compare candidate and baseline behavior by version?
- Capacity tolerance: Can the platform temporarily run additional application capacity?
- Compatibility constraint: How difficult is it for old and new versions to share a database, queue, or API?
Use these scores as prompts, not as an automatic answer. High failure impact and high observability maturity often support canary delivery. High rollback urgency and sufficient spare capacity often favor blue-green deployment. Lower-risk services with compatible schemas and limited platform complexity may be well served by rolling deployment.
A practical cost estimate is:
Release cost = temporary compute capacity + traffic-management overhead + operator time + expected recovery effort.
Do not reduce this calculation to infrastructure spend. A less expensive rollout can be more costly if it increases diagnosis time, customer impact, or manual recovery work. Record the assumptions, compare them with a recent release, and update the estimate when workload size or architecture changes.
Inputs and assumptions
Before selecting a deployment pattern, document the following inputs:
- Capacity: Current replicas or instances, peak utilization, autoscaling limits, and the headroom available during overlap.
- Traffic controls: Whether the load balancer, ingress, service mesh, or cloud routing layer supports weighted, header-based, or environment-level routing.
- Health signals: Availability, latency, error rate, saturation, queue depth, business transactions, and logs grouped by release version.
- Data changes: Whether migrations are additive, reversible, expand-and-contract, or incompatible with the previous application version.
- Stateful behavior: Sessions, caches, long-lived connections, scheduled jobs, consumers, and file writes that may cross deployment boundaries.
- Rollback assets: A known-good image, immutable configuration, migration procedure, routing permissions, and a named decision-maker.
- Automation: Deployment-controller capabilities, pipeline approval gates, alert integration, and whether rollback can be executed without rebuilding.
For Kubernetes, a rolling update can use Deployment readiness checks, controlled batch sizes, and a revision history. Blue-green delivery can use separate Deployments or namespaces behind a Service or ingress route. Canary delivery can use weighted ingress rules, a service mesh, a progressive-delivery controller, or traffic-shifting features in a cloud load balancer. The exact implementation varies by platform version and provider, so verify current capabilities before standardizing a pattern.
Keep traffic control separate from application readiness. A pod being ready means it can accept work according to its probe; it does not prove that latency, business outcomes, dependencies, or data correctness are healthy.
Worked examples
Example 1: Customer-facing API with uncertain behavior
An API has high failure impact, variable traffic, and reliable request-level metrics tagged by version. The platform can route a small percentage of requests to a candidate. A canary deployment is a strong fit: deploy the candidate, route limited traffic, compare error rate and latency with the baseline, and increase exposure only when predefined gates remain healthy. The estimate should include candidate capacity, telemetry retention, and the time an engineer must monitor each stage.
Example 2: Large service with an urgent rollback requirement
A service has a clear environment boundary and enough spare capacity to run two versions temporarily. The release must be reversible within minutes, while its traffic is relatively predictable. Blue-green deployment may be preferable. Keep the previous environment intact, validate the candidate with smoke and dependency checks, shift traffic, and retain the old environment until the observation window ends. Confirm that background workers and database writes will not make switching back unsafe.
Example 3: Internal stateless service with compatible changes
A lower-risk service uses backward-compatible API and schema changes, has standard readiness and liveness checks, and has limited need for segmented traffic analysis. A rolling deployment may provide the best balance of cost and simplicity. Set a conservative batch size, monitor rollout health, and stop automatically when unavailable replicas, errors, or latency exceed the release gate.
Rollback workflow based on health signals
- Define the rollback trigger before deployment, including threshold, duration, and owner.
- Pause traffic progression or stop the rolling update as soon as the trigger is met.
- Confirm whether the signal is release-specific by comparing candidate, baseline, region, endpoint, and dependency metrics.
- Restore traffic to the known-good version or reverse the rollout using the approved controller command.
- Check readiness, error rate, latency, queue depth, and key business transactions after traffic returns.
- Freeze further changes, preserve logs and deployment metadata, and communicate customer impact.
- Handle data changes separately. Reverting application code does not automatically revert a database migration.
Use the SLO and error budget template to turn reliability goals into release gates. If routing failures obscure the result, review the Kubernetes ingress troubleshooting guide.
Release-readiness checklist
- The candidate image and configuration are immutable and traceable to a commit.
- Readiness checks test meaningful dependencies without creating excessive load.
- Baseline and candidate metrics can be separated by version or route.
- Rollback thresholds, observation windows, and approval owners are documented.
- Database, cache, queue, session, and worker compatibility has been reviewed.
- Traffic-shifting permissions and controller behavior have been tested in a non-production environment.
- Rollback does not depend on an unavailable build system or an unverified artifact.
- On-call staff know how to pause, route, roll back, and communicate the change.
For adjacent operational controls, review the secrets rotation runbook, the Kubernetes resource sizing guide, and the Docker image security scanning workflow.
When to recalculate
Revisit this comparison before each high-risk release and after any incident involving deployment, routing, data compatibility, or delayed detection. Recalculate capacity and operator-time assumptions when traffic volume, replica counts, autoscaling limits, cloud routing costs, or observability requirements change.
Review the decision matrix at least annually and after major Kubernetes, ingress, service-mesh, deployment-controller, or cloud-platform changes. Also reassess it when a service becomes stateful, adopts new background workers, changes its database migration process, or moves to a different traffic pattern.
Make the review actionable: record the selected strategy, current assumptions, release gates, rollback owner, and the evidence supporting the choice. If those inputs cannot be verified in a rehearsal, the deployment strategy is not yet ready for a high-risk release.