Blue-Green
Run two environments and flip traffic between them.
You keep two identical environments. Blue runs the current version and takes all traffic. Green gets the new version, is tested in place, and then a single switch moves every user over. Blue stays warm, so rolling back is the same switch in reverse. You pay for it in capacity: for a while you run everything twice.
0.0s / 18s
Step 1 of 6: Blue is live. Four v1 pods make up the blue environment. The Service's selector points at them.
- Availability
- 100%
- No downtime
- Pods running
- 1.00×
- Peak 1.00× of normal
- Blast radius
- —
- Inject a bug to measure
- Time to recover
- —
- No incident
v1 (current)v2 (new)StartingIdle or shadow (no user traffic)SucceededFailed
Trade-offs
More filled is better for you- Uptime during deploy
- 4 out of 4.Instant cut-over
- Low infra cost
- 1 out of 4.2× while both are up
- Rollback speed
- 4 out of 4.Flip the switch back
- Small blast radius
- 1 out of 4.100% of users at the switch
- Simplicity
- 2 out of 4.Two environments to keep in sync
- One version at a time
- 4 out of 4.One version live at a time
Pros and cons
Pros
- Instant cut-over and instant rollback: one selector or DNS change.
- You can test the new version in production infrastructure before any user touches it.
- Users never see a mix of versions.
Cons
- Double the capacity during the release, or permanently if you keep both warm.
- When you flip, every user gets the new version at once. A bug the smoke tests miss hits everyone.
- Shared state (databases, queues, caches) is not duplicated. Both colours must work with the same schema.
When to reach for it
Use it when
- You need instant rollback and can afford temporary 2× capacity.
- Releases must be all-or-nothing, with no mixed-version window.
- You want a real production-like environment to smoke test before going live.
Avoid it when
- Capacity is expensive or scarce, like GPUs or large stateful clusters.
- You want to limit how many users see a risky change. Use Canary.
How to do it
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: shop
spec:
replicas: 4
strategy:
blueGreen:
activeService: shop-active # what users hit
previewService: shop-preview # green, for smoke tests
autoPromotionEnabled: false # wait for a human (or analysis)
prePromotionAnalysis:
templates:
- templateName: smoke-tests
scaleDownDelaySeconds: 600 # keep blue warm for 10 min
selector:
matchLabels: { app: shop }
template:
metadata:
labels: { app: shop }
spec:
containers:
- name: shop
image: registry.example.com/shop:2.0.0Gotchas
- Long-lived connections and sessions stay on blue after the switch. Plan how to drain them.
- Database migrations must be backwards compatible (expand → migrate → contract), because rolling back to blue must still work.
- DNS-based switches are slowed down by TTLs and caching clients. A load balancer or Service selector switch is near-instant.
- Don't scale blue down too fast. Keep it until you're confident (Argo Rollouts' scaleDownDelaySeconds).