What Is Blue-Green & Canary Deployment? Zero Downtime Guide
Does every deployment give you a heart attack? Can you roll back instantly? Blue-Green and Canary Deployment deliver zero-downtime, safe releases.
1. Blue-Green Deployment
Two identical environments. Traffic switches instantly.
Before: LB → [Blue v1.0] ← all traffic
After: LB → [Green v2.0] ← all traffic
Rollback: LB → [Blue v1.0] ← instant switch back
✅ Zero downtime | ✅ Instant rollback | ❌ Double resource cost
2. Canary Deployment
Gradually roll out to a small percentage of users, then increase.
Phase 1: 5% → v2.0 | 95% → v1.0
Phase 2: 25% → v2.0 | 75% → v1.0
Phase 3: 100% → v2.0 → Full rollout ✅
✅ Gradual risk | ✅ Real user validation | ❌ Complex infrastructure
Istio Canary
http:
- route:
- destination: { host: app, subset: stable }
weight: 95
- destination: { host: app, subset: canary }
weight: 5
3. Rolling Update
Update pods one at a time (Kubernetes default).
Comparison
| Strategy | Downtime | Rollback | Risk | Cost | |----------|----------|----------|------|------| | Recreate | Yes | Slow | High | Low | | Rolling | No | Medium | Medium | Low | | Blue-Green | No | Instant | Low | High | | Canary | No | Fast | Lowest | Medium |
Database Migrations
Use the Expand-Migrate-Contract pattern for backward-compatible schema changes.
Best Practices
- Combine with feature flags — Deployment ≠ release
- Health checks required — Auto-rollback unhealthy pods
- Automatic rollback — Set error rate thresholds
- DB backward compatibility — Deploy schema changes separately
- Smoke tests — Automated post-deploy verification
Conclusion
Zero-downtime deployment is the modern standard. Blue-Green provides instant switching, Canary manages risk gradually. Choose based on your team's needs.
Learn deployment strategies on LabLudus.