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 --watchuntil 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 300sRollout strategy
rollout.yaml
spec:
strategy:
canary:
steps:
- setWeight: 20
- pause: { duration: 60 }
- setWeight: 50
- pause: { duration: 60 }Related guides
How to Wait for a Rollout to Finish From CI in GitHub ActionsMake a GitHub Actions deploy fail loudly when pods do not become ready by running kubectl rollout status with…
How to Smoke-Test a Service After Deploy From CI in GitHub ActionsVerify a Kubernetes service is healthy after deploy from GitHub Actions by running a throwaway curl pod with…