Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 37 ยท Operations and Patterns

Progressive Delivery with Argo Rollouts

Add canary and blue-green releases to GitOps with Argo Rollouts: the Rollout resource, steps, analysis, how it cooperates with Argo CD, plus a canary simulator.

A normal Kubernetes Deployment offers one rollout strategy: replace pods gradually (rolling update). It has no notion of "send 5 percent of traffic to the new version, watch the error rate, then continue". Argo Rollouts is a separate project from the same family that adds that: canary and blue-green releases with automated analysis. Argo CD deploys the Rollout; Argo Rollouts decides how the new version reaches users.

Division of labor

Tool Responsibility
Argo CD Make the cluster match Git: apply the new Rollout spec
Argo Rollouts controller Execute the release: create ReplicaSets, shift traffic, run analysis, promote or abort
flowchart LR
  G["Git: new image tag"] --> A["Argo CD sync"]
  A --> R["Rollout resource updated"]
  R --> C["Rollouts controller"]
  C --> S1["20% to new"] --> S2["pause, analyze"] --> S3["50%"] --> S4["100%"]

Argo CD applies the desired state; the Rollouts controller walks the steps.

The Rollout resource

Rollout replaces Deployment in your manifest and keeps almost the same pod template:

YAML
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: shop-web
spec:
  replicas: 5
  selector:
    matchLabels:
      app: shop-web
  template:
    metadata:
      labels:
        app: shop-web
    spec:
      containers:
        - name: web
          image: registry.example.com/shop/web:2.8.1
  strategy:
    canary:
      steps:
        - setWeight: 20
        - pause: {duration: 5m}
        - setWeight: 50
        - pause: {}
        - setWeight: 100

Steps run in order. setWeight moves traffic (or replica share) to the new version. pause: {duration: 5m} waits; a bare pause: {} waits indefinitely until someone promotes it.

Without a traffic router, weights are approximated by the ratio of pods. With a router (NGINX Ingress, Istio, Linkerd, AWS ALB, Gateway API and others) the weight is exact, independent of replica counts.

Blue-green

YAML
strategy:
  blueGreen:
    activeService: shop-web-active
    previewService: shop-web-preview
    autoPromotionEnabled: false
    scaleDownDelaySeconds: 600

The new version (green) comes up fully behind the preview Service. Tests run against it. After promotion, the active Service switches over at once, and the old version stays for a while for fast rollback.

Automated analysis

An AnalysisTemplate queries a metrics provider (Prometheus, Datadog, a web request, a Kubernetes Job and more). A step runs an analysis, and a failed result aborts the rollout and returns traffic to the stable version:

YAML
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: error-rate
spec:
  metrics:
    - name: http-errors
      interval: 1m
      count: 5
      failureLimit: 1
      successCondition: result[0] < 0.02
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: |
            sum(rate(http_requests_total{app="shop-web",code=~"5.."}[2m]))
            / sum(rate(http_requests_total{app="shop-web"}[2m]))

Reference it from the steps with - analysis: {templates: [{templateName: error-rate}]}. Rolling forward only when the data says "fine" is the whole point of progressive delivery.

Using it with Argo CD

  • Health: Argo CD understands Rollout health. A paused rollout appears as Suspended/Progressing, a failed or aborted one as Degraded. Sync can be Synced while the app is still Progressing.
  • Manual promote in the CLI: kubectl argo rollouts promote shop-web, or from the Argo CD UI with the Rollout's resource actions (promote, abort, retry, restart).
  • Auto-sync and aborts: if analysis aborts a rollout, the Rollout spec in Git still says the new image. Argo CD stays Synced (the spec matches Git) but Degraded. The fix is a Git change: revert or fix forward. Do not "heal" by re-syncing repeatedly.
  • Replica ownership: if an HPA scales the Rollout, omit fixed replicas from Git or use ignoreDifferences on /spec/replicas to avoid drift fights.
  • Sync waves: install the Argo Rollouts controller and CRDs in an earlier wave or Application than the Rollouts that use them.
  • Dashboard: kubectl argo rollouts dashboard shows a live view of steps, ReplicaSets and analysis.

Stand-in: a canary release simulator

Argo Rollouts cannot run on the site, so this stand-in walks through canary steps with a fake error-rate series and shows how analysis decides to promote or abort.

Python Stand-in: canary steps with analysis

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Argo Rollouts is optional and has its own documentation and release cycle. Argo CD works perfectly well with plain Deployments; add Rollouts when you need metrics-gated releases.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which tool executes the canary steps and shifts traffic?

    Argo CD applies the Rollout spec; the Rollouts controller carries out the release.
  2. 2. What does a bare pause: {} step do?

    Without a duration the pause is indefinite until a manual promote.
  3. 3. An analysis aborts a rollout, but Git still holds the new image. What does Argo CD show?

    The live spec matches Git, but the Rollout's health is Degraded. Fix it in Git.
  4. 4. How are exact traffic weights achieved?

    Without a router, weights are only approximated by pod ratios.

Summary

  • Argo Rollouts adds canary and blue-green releases; Argo CD deploys the Rollout resource.
  • Steps (setWeight, pause, analysis) define the release; analysis templates gate promotion on metrics.
  • Argo CD shows Rollout health; aborts need a Git fix, not repeated syncs.
  • Handle HPA replicas and CRD ordering deliberately.

Next: Troubleshooting Sync Problems