Skip to content
Ship It
Strategies/Traffic layer

Canary

Send a small slice of traffic to the new version first.

Named after the canary in the coal mine. A small, chosen share of real traffic goes to the new version while you watch error rates and latency. If it looks healthy you widen the share step by step. If it doesn't, you set the weight back to zero and only that slice of users ever saw the problem.

USERSROUTINGPODSIngressv2: 0%canary: 0%v1SERVINGv1SERVINGv1SERVINGv1SERVING
0.0s / 22s

Step 1 of 7: Stable. v1 serves everyone. A traffic router (ingress or service mesh) sits in front and can split by percentage.

Availability
100%
No downtime
Pods running
1.00×
Peak 1.00× of normal
Blast radius
—
Inject a bug to measure
Time to recover
—
No incident
v1 (current)v2 (new)StartingIdle or shadow (no user traffic)SucceededFailed

Trade-offs

More filled is better for you
Uptime during deploy
4 out of 4.No downtime
Low infra cost
2 out of 4.Grows with the weight; 2× at promotion
Rollback speed
4 out of 4.Weight back to 0
Small blast radius
3 out of 4.Only the canary's share
Simplicity
1 out of 4.Needs a traffic router and metrics
One version at a time
1 out of 4.Mixed versions throughout

Pros and cons

Pros

  • Real users and real traffic test the release, with a small blast radius.
  • Traffic share is precise and independent of pod count. 10% means 10%.
  • Rollback is a routing change: fast and safe.

Cons

  • Needs a traffic-splitting layer: ingress controller, service mesh or Gateway API.
  • Only works if you watch the right metrics. A silent bug sails through.
  • Small canaries take time to collect a statistically useful signal.
  • Mixed versions for the whole rollout, so both must be compatible.

When to reach for it

Use it when

  • User-facing services with enough traffic to judge health quickly.
  • Risky changes where limiting exposure matters more than speed.
  • You already have good dashboards or SLOs per version.

Avoid it when

  • Very low traffic. 10% of almost nothing tells you nothing.
  • Changes that can't run side by side, like incompatible schemas or protocols.

How to do it

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: shop
spec:
  replicas: 4
  strategy:
    canary:
      stableService: shop-stable
      canaryService: shop-canary
      trafficRouting:
        nginx:
          stableIngress: shop     # or istio, alb, traefik, Gateway API plugin
      steps:
        - setWeight: 10
        - pause: {}               # wait for: kubectl argo rollouts promote shop
        - setWeight: 25
        - pause: { duration: 10m }
        - setWeight: 50
        - pause: { duration: 10m }
  selector:
    matchLabels: { app: shop }
  template:
    metadata:
      labels: { app: shop }
    spec:
      containers:
        - name: shop
          image: registry.example.com/shop:2.0.0

Gotchas

  • Random per-request splitting means one user can bounce between versions. Use sticky routing if that matters.
  • Compare canary against stable at the same time, not against yesterday's baseline.
  • Watch saturation too. One canary pod receiving 25% of traffic can be overloaded.
  • Without traffic routing, Argo Rollouts approximates weights with pod counts. 1 of 4 pods is 25%, not 10%.
  • By default the stable side stays at full size until promotion, so you briefly run 2×. Argo Rollouts' dynamicStableScale: true scales stable down as the canary grows.

Pairs well with