Perform Canary Deployments using Argo Rollouts
Categories:
Projects:
c2platform/ansible
,
c2platform.core
,
c2platform.mw
The installation steps outlined in the Argo Rollouts
documentation
have already been completed by Ansible during the first step of this tutorial:
Install and Manage Argo CD with Ansible
. This occurs
when you execute the command vagrant up c2d-argocd
. The PlantUML diagram below
depicts the structure set up by Ansible.
Container | Name | Namespace | Kind | Type | Purpose |
---|---|---|---|---|---|
Argo Rollouts Controller | argo-rollouts-**********-***** | argo-rollouts | Pod | Pod(s) running the Argo Rollouts Controller | |
Demo Rollout | rollouts-demo | argo-rollouts-demo | Rollout | Defines how rollout should be managed, for example, using a canary strategy. | |
Stable / Canary Demo Pods | rollouts-demo-**********-***** | argo-rollouts-demo | Pod | Pods running the Argo Rollouts Demo app argoproj/rollouts-demo | |
Demo Service | rollouts-demo | argo-rollouts-demo | Service | LoadBalancer | Defines a service that allows access via http://1.1.4.25 |
Prerequisites
- Install and Manage Argo CD with Ansible: Set up a Kubernetes Cluster, install Argo CD, and manage both using C2 Platform’s Ansible roles for Linux and Kubernetes.
Rollout Status
Using the c2
alias, navigate to the project directory and activate the Python
virtual environment, then SSH into the Argo CD container c2d-argocd
:
c2
vagrant ssh c2d-argocd
Use the Argo Rollouts Kubectl Plugin to see the current status of the rollout.
kubectl argo rollouts get rollout rollouts-demo --watch \
--namespace argo-rollouts-demo
This will display five pods, running based on the image argoproj/rollouts-demo:blue
.

Access Argo Rollouts Demo UI
Launch Firefox using the configured Firefox profile (see
Configure a FireFox Profile
).
Navigate to
http://1.1.4.25/
,
log in as admin
with the password supersecret
. You should see the Argo
Rollouts Demo application. With only “blue” pods running, the app should look
like the image below, displaying only blue squares.

Update Rollout
Use kubectl
to update the rollout to “yellow”:
kubectl argo rollouts set image rollouts-demo \
rollouts-demo=argoproj/rollouts-demo:yellow \
--namespace argo-rollouts-demo
Show me
Name: rollouts-demo
Namespace: argo-rollouts-demo
Status: ॥ Paused
Message: CanaryPauseStep
Strategy: Canary
Step: 1/8
SetWeight: 20
ActualWeight: 20
Images: argoproj/rollouts-demo:blue (stable)
argoproj/rollouts-demo:yellow (canary)
Replicas:
Desired: 5
Current: 5
Updated: 1
Ready: 5
Available: 5
NAME KIND STATUS AGE INFO
⟳ rollouts-demo Rollout ॥ Paused 6h22m
├──# revision:4
│ └──⧉ rollouts-demo-6cf78c66c5 ReplicaSet ✔ Healthy 6h4m canary
│ └──□ rollouts-demo-6cf78c66c5-cmmqb Pod ✔ Running 4m49s ready:1/1
└──# revision:3
└──⧉ rollouts-demo-687d76d795 ReplicaSet ✔ Healthy 6h22m stable
├──□ rollouts-demo-687d76d795-4cw2p Pod ✔ Running 6h22m ready:1/1
├──□ rollouts-demo-687d76d795-fm82t Pod ✔ Running 6h22m ready:1/1
├──□ rollouts-demo-687d76d795-24kbs Pod ✔ Running 6h22m ready:1/1
└──□ rollouts-demo-687d76d795-dg55c Pod ✔ Running 6h22m ready:1/1
According to the rollout specification, the canary deployment is conducted in steps. The first steps involve setting the weight to 20 and then pausing. Thus, one yellow canary pod is initiated and receives 20% of the traffic.
You can find the rollout specification in
group_vars/argocd/argo_rollouts_demo.yml
strategy:
canary:
steps:
- setWeight: 20
- pause: {}
- setWeight: 40
- pause: {duration: 10}
- setWeight: 60
- pause: {duration: 10}
- setWeight: 80
- pause: {duration: 10}
When you navigate to
http://1.1.4.25/
, you should see yellow
squares starting to appear.
Promote Rollout
kubectl argo rollouts promote rollouts-demo \
--namespace argo-rollouts-demo
Abort Rollout
Use kubectl
to update the rollout to “red”:
kubectl argo rollouts set image rollouts-demo \
rollouts-demo=argoproj/rollouts-demo:red \
--namespace argo-rollouts-demo
Abort the rollout
kubectl argo rollouts abort rollouts-demo \
--namespace argo-rollouts-demo
Aborting the rollout will change its status to “degraded”. To stabilize it again, update the rollout back to yellow:
kubectl argo rollouts set image rollouts-demo \
rollouts-demo=argoproj/rollouts-demo:yellow \
--namespace argo-rollouts-demo
Additional Information
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.