Perform Canary Deployments using Argo Rollouts

Perform canary deployments using Argo Rollouts and the Argo Rollouts demo application.

Projects: c2platform/ansible, c2platform.core, c2platform.mw


The installation steps as documented as part of Argo Rollouts documentation website  are already performed by Ansible as part of the first step of this tutorial: Install and Manage Argo CD with Ansible . This is when you ran the command vagrant up c2d-argocd. Getting Started  and, secondaryly to verify and review how Ansible is used to achieve this result.

The PlantUML diagram visualises what Ansible has created for us in the previous stap C2 Platform’s Linux, MicroK8s and Kubernetes role, respecivtley c2platform.core.linux  , c2platform.mw.microk8s  and c2platform.mw.kubernetes  .

ContainerNameNamespaceKindTypePurpose
Argo Rollouts Controllerargo-rollouts-**********-*****argocd-rolloutsPodPod(s) running the Argo Rollouts Controller
Demo Rolloutrollouts-demoargocd-rollouts-demoRolloutDefines how rollout should be managed for example using canary strategy.
Stable / Canary Demo Podsrollouts-demo-**********-*****argocd-rollouts-demoPodPods running the Argo Rollouts Demo app argoproj/rollouts-demo
Demo Servicerollouts-demoargocd-rollouts-demoServiceLoadBalancerDefines service that allows access using http://1.1.4.25 

Prerequisites

Rollout Status

Using c2 alias, cd into the project directory and activate the Python virtual environment, yhen SSH into the Argo CD container c2d-argocd:

c2
vagrant ssh c2d-argocd

Use Argo Rollouts Kubectl Plugin to see the status of the rollout.

kubectl argo rollouts get rollout rollouts-demo --watch \
  --namespace argocd-rollouts-demo

This should show 5 pods running based on 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/  , login as admin with the password supersecret. You should see the Argo Rollouts Demo application. With only “blue” pods running, the app should look like image below, with 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 argocd-rollouts-demo

Show me

Name:            rollouts-demo
Namespace:       argocd-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

Per the rollout spec, the canary deployment is performed in steps. This first steps are to set the weight 20 and then pause. So one yellow canary pod is started and gets 20% of traffic.

You can find the rollout spec 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}

If navigate to http://1.1.4.25/  , you should see yellow squares appearing.

Promote Rollout

kubectl argo rollouts promote rollouts-demo \
  --namespace argocd-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 argocd-rollouts-demo

Abort the rollout

kubectl argo rollouts abort rollouts-demo \
  --namespace argocd-rollouts-demo

Aborting the rollout will put status to “degraded”. To get it to stable again, update the rollout back to yellow:

kubectl argo rollouts set image rollouts-demo \
  rollouts-demo=argoproj/rollouts-demo:yellow \
  --namespace argocd-rollouts-demo

Additional Information



Last modified January 29, 2025: argocd rollouts concept C2-709 (f329fd3)