Blue-Green with Argo Rollouts — two environments, instant switching.
1apiVersion: argoproj.io/v1alpha12kind: Rollout3metadata:4 name: myapp5spec:6 replicas: 57 selector:8 matchLabels:9 app: myapp10 template:11 metadata:12 labels:13 app: myapp14 spec:15 containers:16 - name: myapp17 image: myapp:2.018 ports:19 - containerPort: 808020 strategy:21 blueGreen:22 activeService: myapp-active23 previewService: myapp-preview24 autoPromotionEnabled: false25 prePromotionAnalysis:26 templates:27 - templateName: success-rate28 args:29 - name: service-name30 value: myapp-preview31 postPromotionAnalysis:32 templates:33 - templateName: success-rate34 args:35 - name: service-name36 value: myapp-active37 scaleDownDelaySeconds: 30038 prePromotionAnalysisTemplates:39 - templateName: smoke-test
Active/Preview Services:
1apiVersion: v12kind: Service3metadata:4 name: myapp-active5spec:6 selector:7 app: myapp8 ports:9 - port: 8010 targetPort: 808011---12apiVersion: v113kind: Service14metadata:15 name: myapp-preview16spec:17 selector:18 app: myapp19 ports:20 - port: 8021 targetPort: 8080
Promotion:
1kubectl argo rollouts promote myapp2kubectl argo rollouts reject myapp # rollback3kubectl argo rollouts status myapp4kubectl argo rollouts get rollout myapp --watch
PrePromotionAnalysis — verification of preview before switching. PostPromotionAnalysis — verification of active after switching.