Flagger: Canary Deployments Made Automatic
Deploying to production is terrifying. One bad release can take down everything. Flagger automates canary deployments, A/B testing, and blue/green deployments on Kubernetes — rolling back automatically when metrics go bad.
How Flagger Works
Flagger gradually shifts traffic to new versions while monitoring metrics. If error rates spike or latency increases, it automatically rolls back. Zero human intervention.
[v1: 100%] -> [v1: 90%, v2: 10%] -> [v1: 50%, v2: 50%] -> [v2: 100%]
| (if metrics bad)
[v1: 100%] <- automatic rollback
The Free API (CRDs)
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: my-app
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
service:
port: 80
analysis:
interval: 30s
threshold: 5
maxWeight: 50
stepWeight: 10
metrics:
- name: request-success-rate
thresholdRange:
min: 99
interval: 1m
- name: request-duration
thresholdRange:
max: 500
interval: 1m
# Check canary status
kubectl get canaries -A
# Watch canary progression
kubectl describe canary my-app
# Manual promotion
kubectl annotate canary my-app flagger.app/promote=true
Supported Service Meshes
- Istio — full feature support
- Linkerd — lightweight option
- App Mesh — AWS native
- Contour — HTTPProxy based
- Nginx Ingress — no mesh required
- Gloo Edge — API gateway
- Traefik — popular ingress
Real-World Use Case
An e-commerce platform was losing $50K per bad deployment. After implementing Flagger with Istio, bad releases get caught at 10% traffic — automatic rollback in under 2 minutes. Zero downtime incidents in 6 months.
Quick Start
helm repo add flagger https://flagger.app
helm install flagger flagger/flagger \\
--namespace flagger-system \\
--set meshProvider=istio \\
--set metricsServer=http://prometheus:9090
Resources
Need automated data pipelines for your deployment metrics? Check out my data tools on Apify or email spinov001@gmail.com for custom automation.
Top comments (0)