Skip to content

Lesson 7 of 9 · 28m

Progressive Delivery with Canaries and Rollouts

Use Argo Rollouts or Flagger to shift traffic gradually, evaluate real service metrics, and make abort behavior safer than human panic.

A canary is not a small deployment. It is an experiment with a predefined failure budget. Teams fail at progressive delivery when they copy a rollout manifest but never decide what evidence proves the new version healthy. Traffic splitting without analysis is just slower exposure. Progressive delivery works when the control loop can pause, measure, and reverse before humans are even awake.

Choose the traffic layer first

Replica-ratio splitting is rough but portable. Service meshes give precise layer-seven control, ingress controllers provide common HTTP splitting semantics, and API gateways sometimes move the decision outside cluster GitOps. Argo Rollouts integrates with Istio, NGINX Ingress, AWS ALB, and others; Flagger supports several providers too. The key question is whether routing and workload rollout are governed as one coherent release or accidentally managed by two loops.

Argo Rollouts makes steps explicit

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata: {name: checkout-api}
spec:
  replicas: 6
  selector: {matchLabels: {app: checkout-api}}
  template:
    metadata: {labels: {app: checkout-api}}
    spec:
      containers: [{name: api, image: ghcr.io/sudosecurityorg/checkout-api@sha256:4f1e2b93a760d6db2d91cb0e90f0e5cfef6de60f00a53d16f2f6efb1f7642c21}]
  strategy:
    canary:
      steps: [{setWeight: 10}, {pause: {duration: 5m}}, {setWeight: 30}, {pause: {duration: 10m}}, {setWeight: 60}, {pause: {duration: 10m}}]

Those pauses are not arbitrary ceremony. They give error rates, latency percentiles, queues, downstream saturation, and business metrics time to reveal failure. Five minutes may be meaningless for a low-traffic service.

Automated analysis beats vibes

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata: {name: checkout-success}
spec:
  metrics:
    - name: error-rate
      interval: 30s
      failureLimit: 2
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: sum(rate(http_requests_total{service="checkout-api-canary",code=~"5.."}[2m])) / sum(rate(http_requests_total{service="checkout-api-canary"}[2m]))
      successCondition: result[0] < 0.01

Reference the template from spec.strategy.canary.analysis.templates, and write queries against the canary series where possible, not the blended service. If only 5% of traffic reaches the new pod, aggregate metrics can hide catastrophic failure. Conversely, small sample sizes produce noisy false failures; define minimum traffic thresholds.

Abort behavior is part of the release

When analysis fails, the controller shifts traffic back and scales down the canary. Test that path. Many teams rehearse the happy rollout and discover during the first real abort that ingress annotations, readiness gates, or connection draining do not behave as expected.

kubectl argo rollouts get rollout checkout-api -n checkout --watch

The promote and abort subcommands are the manual overrides. If humans routinely click promote without reading analysis, you have built a more complicated deployment button.

Blue-green is different from canary

Blue-green keeps two full environments and switches traffic atomically. It is useful when partial versions cannot coexist, but it doubles capacity cost and makes rollback depend on the old environment remaining valid. Canary is fractional exposure; blue-green is a traffic cutover. Do not use the words interchangeably in incident review.

Field notes

  • Progressive delivery does not fix incompatible database schema changes; use expand-and-contract migrations.
  • If old and new versions write mutually incompatible data, traffic rollback can be impossible even when pods are healthy.
  • Keep the canary analysis window longer than your largest retry or queue-delay behavior.
  • Progressive delivery increases the number of moving objects. Ownership in Git must be crystal clear or GitOps itself will fight rollout resources.

Was this lesson helpful?

Sign in to rate