Canary Deployment
In one line
Canary deployment routes a small percentage of traffic to the new version first, increasing gradually to limit blast radius.
In simple words
A canary deployment releases a new version to a small subset of users or servers first, then gradually increases the rollout if no errors are detected. The name comes from the canary in a coal mine — an early warning system.
Process: 1. Deploy to 5% of servers 2. Monitor metrics 3. If healthy, increase to 25% → 50% → 100% 4. If problems appear, roll back immediately
Advantages over blue-green: issues affect only a small percentage of users. Disadvantages: more complex, requires good monitoring.
Example
kubectl set image deployment/my-app app=my-app:v2
kubectl scale deployment/my-app --replicas=1 # 1 of 20 pods = 5%
# Monitor, then scale to 10 (50%), then 20 (100%)
# If errors: kubectl rollout undo deployment/my-appStart with 5% of pods running the new version. Monitor metrics. If healthy, gradually scale up. If errors appear, roll back instantly.
Common confusions
Confused with: Blue-Green Deployment
The difference: Blue-green switches 100% of traffic at once. Canary gradually increases traffic (5% → 25% → 100%), limiting the blast radius. Canary is safer but slower.
Related terms
Related Resources
Related Lessons
- Deployment Strategies
Canary deployments.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.