Skip to content

Argo Rollouts Reference: Canary, Blue-Green, AnalysisTemplate & Progressive Delivery

Argo Rollouts is a Kubernetes controller for advanced deployment strategies — canary releases, blue-green deployments, and analysis-gated progressive delivery. It extends the standard Deployment resource with fine-grained traffic shifting and automated rollback based on metrics.

1. Rollouts vs Standard Deployments

Why Rollouts, what it adds to kubectl rollout
Feature Standard Deployment Argo Rollouts
Canary release Weight-based only (crude) Step-by-step weight + header-based via service mesh
Blue-green Manual swap via selector Automated with active/preview services
Automated rollback Manual (kubectl rollout undo) Automatic on metric/analysis failure
Traffic management Pod count ratio only Nginx, AWS ALB, Istio, Linkerd, SMI weights
Analysis None AnalysisTemplate: Prometheus, Datadog, web hooks
CLI kubectl rollout kubectl argo rollouts (or kubectl plugin)
# Install Argo Rollouts:
kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml

# Install kubectl plugin:
brew install argoproj/tap/kubectl-argo-rollouts  # macOS
# Or: curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64

kubectl argo rollouts version
kubectl argo rollouts dashboard &    # opens browser UI on :3100

2. Canary Rollout

Step-based canary with traffic shifting
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: my-app
  namespace: production
spec:
  replicas: 10
  selector:
    matchLabels: {app: my-app}
  template:
    metadata:
      labels: {app: my-app}
    spec:
      containers:
        - name: my-app
          image: my-app:1.2.0       # update this to trigger the rollout
          ports: [{containerPort: 8080}]
  strategy:
    canary:
      # Canary steps — executed in order:
      steps:
        - setWeight: 10             # 10% of traffic to new version
        - pause: {duration: 5m}    # wait 5 minutes
        - setWeight: 30
        - pause: {}                 # pause indefinitely — manual approval required
        - setWeight: 60
        - pause: {duration: 10m}
        # After all steps: 100% traffic to new version → old pods removed
      canaryService: my-app-canary  # Service pointing to canary pods
      stableService: my-app-stable  # Service pointing to stable pods

# Services needed (for traffic splitting by service mesh/ingress):
apiVersion: v1
kind: Service
metadata:
  name: my-app-canary
spec:
  selector: {app: my-app}
  ports: [{port: 80, targetPort: 8080}]
---
apiVersion: v1
kind: Service
metadata:
  name: my-app-stable
spec:
  selector: {app: my-app}
  ports: [{port: 80, targetPort: 8080}]

3. Blue-Green Rollout

Zero-downtime deployments with instant traffic switch
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: my-app-bg
spec:
  replicas: 5
  selector:
    matchLabels: {app: my-app}
  template:
    metadata:
      labels: {app: my-app}
    spec:
      containers:
        - name: my-app
          image: my-app:2.0.0
  strategy:
    blueGreen:
      activeService: my-app-active       # production traffic goes here
      previewService: my-app-preview     # new version spun up here first
      autoPromotionEnabled: false        # require manual promotion
      prePromotionAnalysis:
        templates:
          - templateName: success-rate   # run analysis before promoting
        args:
          - name: service-name
            value: my-app-preview
      scaleDownDelaySeconds: 30         # keep old (blue) pods for 30s after switch

# Manual promotion commands:
kubectl argo rollouts promote my-app-bg -n production    # promote preview → active
kubectl argo rollouts abort my-app-bg -n production      # abort, rollback to stable
kubectl argo rollouts undo my-app-bg -n production       # undo last rollout

4. AnalysisTemplate — Automated Rollback

Gate rollout progress on Prometheus metrics, webhooks, or job output
# AnalysisTemplate: defines how to measure success
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: success-rate
  namespace: production
spec:
  args:
    - name: service-name              # passed from Rollout
  metrics:
    - name: success-rate
      interval: 1m                    # measure every minute
      count: 5                        # evaluate 5 times total
      successCondition: result[0] >= 0.95   # 95%+ success rate required
      failureLimit: 3                 # allow 3 failures before aborting
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: |
            sum(rate(
              http_requests_total{service="{{ args.service-name }}", status!~"5.."}[5m]
            )) /
            sum(rate(
              http_requests_total{service="{{ args.service-name }}"}[5m]
            ))

    # Web hook metric (call an external service):
    - name: integration-tests
      provider:
        web:
          url: "https://ci.example.com/api/tests/{{ args.service-name }}/status"
          headers:
            - key: Authorization
              value: "Bearer {{ secrets.ci-token }}"
          successCondition: result.status == "passed"

# Add analysis to canary steps:
strategy:
  canary:
    steps:
      - setWeight: 20
      - analysis:
          templates:
            - templateName: success-rate
          args:
            - name: service-name
              value: my-app-canary
      - pause: {}                     # if analysis passes, wait for manual approval
      - setWeight: 100
If the AnalysisRun fails (error rate too high), Argo Rollouts automatically aborts and routes 100% traffic back to the stable version — zero manual intervention needed.

5. CLI & Operations

kubectl plugin commands for day-to-day operations
# Install kubectl plugin:
kubectl krew install argo-rollouts   # via krew (kubectl plugin manager)

# Key commands:
kubectl argo rollouts list rollouts -n production        # all rollouts + status
kubectl argo rollouts status my-app -n production        # current rollout status
kubectl argo rollouts get rollout my-app -n production --watch  # live progress

# Control rollout progression:
kubectl argo rollouts promote my-app -n production       # advance past pause
kubectl argo rollouts promote my-app --full -n production  # skip all remaining steps
kubectl argo rollouts pause my-app -n production         # pause at current step
kubectl argo rollouts abort my-app -n production         # abort, route back to stable
kubectl argo rollouts undo my-app -n production          # roll back (undo last update)

# Update the image (triggers rollout):
kubectl argo rollouts set image my-app my-app=my-app:1.3.0 -n production

# Inspect analysis:
kubectl argo rollouts get rollout my-app -n production   # shows AnalysisRun status
kubectl get analysisrun -n production
kubectl describe analysisrun my-app-xxx -n production    # metric values + pass/fail

# Dashboard (web UI):
kubectl argo rollouts dashboard                          # :3100

Track Argo Rollouts, ArgoCD, and progressive delivery tool releases.
ReleaseRun monitors Kubernetes, Docker, and 13+ DevOps technologies.

Related: ArgoCD & GitOps Reference | Istio Reference | Kubernetes YAML Reference

🔍 Free tool: K8s YAML Security Linter — check your Argo Rollouts manifests for K8s security misconfigurations alongside your deployment strategy.

Founded

2023 in London, UK

Contact

hello@releaserun.com