Skip to content
Latchkey

How to Run a Canary Deploy With Argo Rollouts From CI in GitHub Actions

Argo Rollouts replaces a plain Deployment with a Rollout that shifts traffic in weighted steps; CI just sets the new image and watches the status.

Update the Rollout with kubectl argo rollouts set image, then kubectl argo rollouts status to block until the canary completes or aborts.

Steps

  • Install the Argo Rollouts controller and the kubectl plugin.
  • Set the new image with kubectl argo rollouts set image.
  • Block on kubectl argo rollouts status --watch until Healthy.

Workflow

.github/workflows/deploy.yml
steps:
  - run: |
      curl -sSLo rollouts https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
      install -m 0755 rollouts /usr/local/bin/kubectl-argo-rollouts
  - run: |
      kubectl argo rollouts set image web \
        web=ghcr.io/acme/web:${{ github.sha }} -n prod
  - run: kubectl argo rollouts status web -n prod --timeout 300s

Rollout strategy

rollout.yaml
spec:
  strategy:
    canary:
      steps:
        - setWeight: 20
        - pause: { duration: 60 }
        - setWeight: 50
        - pause: { duration: 60 }

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →