← All writing

Oct 2026 · Kubernetes · Ramesh Godishela

Safe Deployments with Argo Rollouts

A plain Kubernetes Deployment swaps out pods and hopes for the best. Argo Rollouts lets you ship to a slice of traffic first, check the numbers, and roll back on its own if they look bad.

Install

Install the kubectl plugin and check it works:

brew install argoproj/tap/kubectl-argo-rollouts
kubectl argo rollouts version

Install the controller into its own namespace and confirm the resources came up:

kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
kubectl get all -n argo-rollouts

Define a Rollout

A Rollout replaces a Deployment. It takes the same pod template, plus a strategy that says how to move traffic to the new version.

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: test-rollout
  namespace: default
spec:
  replicas: 3
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: test-app
  template:
    metadata:
      labels:
        app: test-app
    spec:
      containers:
      - name: test-container
        image: your-docker-image:tag
        ports:
        - containerPort: 80
  strategy:
    canary:
      canaryService: canary-service
      stableService: stable-service
      steps:
      - setWeight: 20
      - pause: { duration: 1m }
      - setWeight: 50
      - pause: { duration: 2m }
      - setWeight: 100
  • Canary strategy: shifts traffic to the new version in stages instead of all at once.
  • setWeight: the share of traffic the new version gets.
  • pause: time to watch metrics before the next step. Leave out duration to wait for a manual promote.

Without a traffic router, Argo approximates the weight by scaling canary pods, so with only 3 replicas the split is coarse. A traffic router (below) gives exact percentages.

Route traffic to stable and canary

Create two Services with the same selector. Argo adds a pod-template hash to each one, so stable-service only reaches stable pods and canary-service only reaches canary pods.

apiVersion: v1
kind: Service
metadata:
  name: stable-service
spec:
  selector:
    app: test-app
  ports:
  - port: 80
---
apiVersion: v1
kind: Service
metadata:
  name: canary-service
spec:
  selector:
    app: test-app
  ports:
  - port: 80

For precise traffic splits, add trafficRouting to the canary strategy and plug in Istio, NGINX or the AWS Load Balancer Controller.

Apply and watch

kubectl apply -f rollout.yaml
kubectl argo rollouts get rollout test-rollout --watch
kubectl argo rollouts dashboard   # web UI on localhost:3100

If the canary looks healthy, send it all traffic. If not, roll back:

kubectl argo rollouts promote test-rollout
kubectl argo rollouts abort test-rollout

Let metrics make the call

Manual checks don't scale. An AnalysisTemplate queries your metrics during the rollout and aborts it if they cross a line. This one fails the canary if more than 5% of requests return a 5xx:

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: error-rate
spec:
  metrics:
  - name: error-rate
    interval: 1m
    failureLimit: 1
    successCondition: result[0] < 0.05
    provider:
      prometheus:
        address: http://prometheus-server
        query: |
          sum(rate(http_requests_total{app="test-app",status=~"5.."}[5m]))
          /
          sum(rate(http_requests_total{app="test-app"}[5m]))

Measure errors as a share of all requests, not a raw count. A raw count of errors per second means different things at 10 and 10,000 requests per second.

Reference the template from a step in the Rollout:

      steps:
      - setWeight: 20
      - pause: { duration: 1m }
      - analysis:
          templates:
          - templateName: error-rate

Before you go to production

  • Run the whole flow in staging first.
  • Watch logs and metrics while traffic is split, and make sure you can tell canary traffic from stable.
  • Turn on Argo Rollouts notifications so promotions, pauses and aborts show up in Slack.