Cloud Native 20 min read

Mastering Canary and Blue‑Green Deployments with Argo Rollouts on Kubernetes

This guide explains what Argo Rollouts is, how to install it, and demonstrates step‑by‑step canary, blue‑green, and traffic‑shifting deployments on Kubernetes using NGINX Ingress, including commands for updating, promoting, aborting, and rolling back releases.

Ops Development Stories
Ops Development Stories
Ops Development Stories
Mastering Canary and Blue‑Green Deployments with Argo Rollouts on Kubernetes

What is Argo Rollouts

Argo Rollouts is a Kubernetes controller and a set of CRDs that provide advanced Deployment capabilities such as canary, blue‑green, experimentation, and progressive delivery.

Supported features include:

Blue‑green update strategy

Canary update strategy

Fine‑grained weighted traffic shifting

Automatic rollback and promotion

Manual judgement

Custom metric queries and business KPI analysis

Ingress integration: NGINX, ALB

Service mesh integration: Istio, Linkerd, SMI

Metric provider integration: Prometheus, Wavefront, Kayenta, Web, Kubernetes Jobs

Argo works similarly to a Deployment but adds rollout strategies and traffic control. When the spec.template changes, Argo Rollouts creates a new ReplicaSet and gradually scales down the previous one.

Installation

Install according to the official documentation: https://argoproj.github.io/argo-rollouts/installation/#kubectl-plugin-installation

Install Argo Rollouts in the cluster

kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://raw.githubusercontent.com/argoproj/argo-rollouts/stable/manifests/install.yaml

Install the kubectl plugin

curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
chmod +x ./kubectl-argo-rollouts-linux-amd64
mv ./kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts

Canary Release

Canary release consists of Replica Shifting and Traffic Shifting.

Replica Shifting: version replacement

Traffic Shifting: traffic routing

Example using the official demo:

Deploy the application

kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/basic/rollout.yaml
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/basic/service.yaml

rollout.yaml content:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollouts-demo
spec:
  replicas: 5
  strategy:
    canary:
      steps:
      - setWeight: 20
      - pause: {}
      - setWeight: 40
      - pause: {duration: 10}
      - setWeight: 60
      - pause: {duration: 10}
      - setWeight: 80
      - pause: {duration: 10}
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: rollouts-demo
  template:
    metadata:
      labels:
        app: rollouts-demo
    spec:
      containers:
      - name: rollouts-demo
        image: argoproj/rollouts-demo:blue
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
        resources:
          requests:
            memory: 32Mi
            cpu: 5m

The strategy field defines the rollout steps, where setWeight sets traffic weight and pause pauses (manual if no duration, automatic otherwise).

service.yaml defines a standard Service:

apiVersion: v1
kind: Service
metadata:
  name: rollouts-demo
spec:
  ports:
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
  selector:
    app: rollouts-demo

After applying, five pods are created in the default namespace. Use:

kubectl argo rollouts get rollout rollouts-demo

to view status. The rollout can be watched with --watch.

Update the application

Update the image with:

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

The rollout pauses at the first step (weight 20%). Use kubectl argo rollouts promote rollouts-demo to continue, or kubectl argo rollouts abort rollouts-demo to abort.

Rollback

Rollback to a previous revision with:

kubectl-argo-rollouts undo rollouts-demo --to-revision=1

Traffic Shifting

Argo Rollouts integrates with Ingress and Service Mesh for traffic control. The example uses NGINX Ingress.

Deploy with Ingress

kubectl delete -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/basic/rollout.yaml
kubectl delete -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/basic/service.yaml
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/nginx/rollout.yaml
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/nginx/services.yaml
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/nginx/ingress.yaml

rollout.yaml sets canaryService and stableService and configures NGINX traffic routing with a weight of 50%.

When the rollout is created, Argo creates an additional canary Ingress that routes traffic to the canary Service.

Updating the image triggers the canary Ingress to add the nginx.ingress.kubernetes.io/canary-weight annotation (e.g., "50"). The UI shows the traffic split.

Continue with kubectl argo rollouts promote rollouts-demo or abort with kubectl argo rollouts abort rollouts-demo.

Conclusion

Argo Rollouts provides richer deployment capabilities than the native Deployment, including canary and blue‑green strategies that are useful for operations. Blue‑green can be enabled by configuring a Rollout with a blueGreen strategy.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KubernetesBlue‑Green deploymentService MeshIngresscanary deploymentArgo RolloutsProgressive Delivery
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.