Stage 5 · Platform
GitOps & Progressive Delivery
Argo Rollouts
Configuring Rollout resources, AnalysisTemplates, Prometheus metrics, pause steps, and traffic routers.
Rollout Resource
Argo Rollouts extends Kubernetes with a Rollout CRD that replaces the standard Deployment. It supports canary and blue-green strategies with automated analysis and traffic shaping. The Rollout resource is a drop-in replacement for Deployment — it uses the same pod template spec.
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: myapp
spec:
replicas: 5
revisionHistoryLimit: 5
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: ghcr.io/myorg/myapp:2.0.0
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 5The Rollout resource looks identical to a Deployment. The difference is in the strategy section. Argo Rollouts controller watches Rollout resources and manages the progressive delivery lifecycle.
Canary Strategy
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: myapp
spec:
replicas: 10
strategy:
canary:
canaryService: myapp-canary
stableService: myapp-stable
trafficRouting:
nginx:
stableIngress: myapp-ingress
steps:
- setWeight: 10
- pause: { duration: 5m }
- setWeight: 25
- pause: { duration: 5m }
- setWeight: 50
- pause: { duration: 10m }
- setWeight: 75
- pause: { duration: 5m }
- setWeight: 100
analysis:
templates:
- templateName: canary-analysis
startingStep: 2
args:
- name: service-name
value: myapp-canaryThe canary strategy gradually increases traffic weight. At each step, AnalysisTemplates verify the canary is healthy. If analysis fails, the rollout is aborted. The stableService receives traffic for non-canary pods.
Blue-Green Strategy
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: myapp
spec:
replicas: 5
strategy:
blueGreen:
activeService: myapp-active
previewService: myapp-preview
autoPromotionEnabled: false
prePromotionAnalysis:
templates:
- templateName: blue-green-analysis
postPromotionAnalysis:
templates:
- templateName: post-promotion-analysis
scaleDownDelaySeconds: 300
previewReplicaCount: 2
antiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
weight: 100Blue-green deploys the new version to a preview environment. Pre-promotion analysis verifies the new version before switching traffic. autoPromotionEnabled: false requires manual approval. scaleDownDelaySeconds keeps the old version running after promotion for quick rollback.
Analysis Templates
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: canary-analysis
spec:
args:
- name: service-name
metrics:
- name: success-rate
interval: 2m
count: 5
successCondition: result[0] >= 0.99
failureLimit: 3
provider:
prometheus:
address: http://prometheus:9090
query: |
sum(rate(http_requests_total{service="{{args.service-name}}",status!~"5.."}[2m]))
/
sum(rate(http_requests_total{service="{{args.service-name}}"}[2m]))
- name: latency
interval: 2m
count: 5
successCondition: result[0] <= 500
failureLimit: 3
provider:
prometheus:
address: http://prometheus:9090
query: |
histogram_quantile(0.95,
sum(rate(http_request_duration_seconds_bucket{service="{{args.service-name}}"}[2m])) by (le)
) * 1000
- name: error-rate
interval: 1m
count: 3
successCondition: result[0] <= 0.01
failureLimit: 2
provider:
prometheus:
address: http://prometheus:9090
query: |
sum(rate(http_requests_total{service="{{args.service-name}}",status=~"5.."}[1m]))
/
sum(rate(http_requests_total{service="{{args.service-name}}"}[1m]))AnalysisTemplates define success/failure criteria using metrics from Prometheus. successCondition is a boolean expression — the analysis passes when it evaluates to true. failureLimit allows some failures before aborting.
Traffic Routers
| Router | Use Case |
|---|---|
| NGINX Ingress | NGINX ingress controller with canary annotations |
| Istio | Service mesh with VirtualService traffic splitting |
| Linkerd | Service mesh with traffic split CRD |
| AWS ALB | Application Load Balancer with target group weights |
| Gateway API | Kubernetes Gateway API with HTTPRoute |
Abort and Rollback
# Abort the current rollout
kubectl argo rollouts abort myapp -n production
# Retry the rollout
kubectl argo rollouts retry myapp -n production
# Promote to the next step
kubectl argo rollouts promote myapp -n production
# Promote to the final step
kubectl argo rollouts promote --full myapp -n production
# Check rollout status
kubectl argo rollouts status myapp -n production
# View rollout history
kubectl argo rollouts history myapp -n productionThe CLI provides full control over the rollout lifecycle. abort stops the rollout and routes traffic back to stable. promote advances to the next step. promote --full skips all remaining steps and fully promotes the canary.
Add pause steps with no duration to create manual gates. The rollout pauses indefinitely until someone runs kubectl argo rollouts promote. This allows manual verification before traffic increases.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.