- Two versions run side by side. Active service serves prod, preview service points at the new version
- Promotion switches the active service to the new ReplicaSet all at once
- Needs two Services, and the controller manages their selectors
strategy:
blueGreen:
activeService: my-app-active
previewService: my-app-preview
autoPromotionEnabled: false
scaleDownDelaySeconds: 30
activeService - prod traffic (required)
previewService - new version for testing
autoPromotionEnabled - promote as soon as the new RS is ready. Default true
autoPromotionSeconds - wait this long before promoting (when autoPromotionEnabled: false, a pause with auto resume)
scaleDownDelaySeconds - how long the old RS stays up after promotion (default 30)
scaleDownDelayRevisionLimit - how many old RSs to keep scaled up
previewReplicaCount - fewer replicas for preview
prePromotionAnalysis / postPromotionAnalysis
- New RS created and scaled up,
previewService selector points at it
- Test against preview
- Promote:
activeService selector switches to the new RS
- Old RS scaled down after
scaleDownDelaySeconds
kubectl argo rollouts get rollout my-app-bluegreen
kubectl argo rollouts promote my-app-bluegreen
strategy:
blueGreen:
activeService: my-app-active
previewService: my-app-preview
prePromotionAnalysis:
templates:
- templateName: smoke-tests
args:
- name: service-name
value: my-app-preview
postPromotionAnalysis:
templates:
- templateName: production-checks
- Pre failure: promotion is blocked and the rollout aborts
- Post failure: rollout aborts and traffic goes back to the previous version
kubectl argo rollouts abort my-app-bluegreen # active stays on stable, preview RS scaled down
kubectl argo rollouts undo my-app-bluegreen # back to previous revision
kubectl argo rollouts undo my-app-bluegreen --to-revision=3
- Long
scaleDownDelaySeconds keeps the old version around for fast rollback after promotion
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: nginx-rollout
spec:
replicas: 3
revisionHistoryLimit: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.19
ports:
- containerPort: 80
strategy:
blueGreen:
activeService: nginx-active
previewService: nginx-preview
autoPromotionEnabled: true
autoPromotionSeconds: 600
- Both Services (
nginx-active, nginx-preview) are plain ClusterIP services with selector app: nginx
- Uses more resources than canary (full duplicate)
- No gradual traffic, so no partial exposure
- Good when you want full validation before release