Argo Rollouts: Advanced Deployment Strategies for Kubernetes
Argo Rollouts is a Kubernetes operator that adds blue‑green, canary, analysis, experiment, and progressive delivery capabilities, offering automated GitOps‑driven rollouts, detailed implementation principles, architecture components, installation steps, and practical usage examples with code snippets for cloud‑native applications.
Overview
Argo Rollouts is a Kubernetes Operator that provides advanced deployment capabilities such as blue‑green, canary, canary analysis, experiments, and progressive delivery, enabling automated, GitOps‑based incremental releases for cloud‑native applications and services.
Key Features
Blue‑Green update strategy
Canary update strategy
Fine‑grained weighted traffic splitting
Automatic rollback
Manual promotion
Custom metric queries and business KPI analysis
Ingress controller integration: NGINX, ALB
Service mesh integration: Istio, Linkerd, SMI
Metrics provider integration: Prometheus, Wavefront, Kayenta, Datadog, New Relic, etc.
Implementation Principle
Similar to a Deployment, the Argo Rollouts controller manages the creation, scaling, and deletion of ReplicaSets defined by the spec.template field of a Rollout resource. When spec.template changes, the controller creates a new ReplicaSet and follows the strategy defined in spec.strategy to transition from the old ReplicaSet to the new one. Once the new ReplicaSet is scaled up (optionally after an Analysis), it is marked as stable .
If another change to spec.template occurs while a transition is in progress, the previously created ReplicaSet is scaled down and the controller starts a new rollout for the latest template.
Related Concepts
A Rollout is a Kubernetes Custom Resource Definition (CRD) that functions like a Deployment but adds advanced deployment and progressive delivery features.
Blue‑Green deployment
Canary deployment
Integration with Ingress controllers and service meshes for sophisticated traffic routing
Integration with metric providers for analysis
Automatic promotion or rollback based on success/failure metrics
Progressive Delivery
Progressive delivery releases product updates in a controlled, incremental manner, reducing risk by combining automation with metric analysis to drive automatic upgrades or rollbacks.
Deployment Strategies
RollingUpdate : Gradually replace old pods with new ones while maintaining the total replica count (default for Deployments).
Recreate : Delete all old pods before starting new ones, causing downtime during the transition.
Blue‑Green : Deploy a new version alongside the old one; traffic is switched to the new version only after verification.
Canary : Expose a small portion of users to the new version while the majority continue using the old version; traffic weight can be increased gradually.
Architecture
The following components are managed by Argo Rollouts:
Rollout Controller : Watches cluster events and reconciles Rollout resources to the desired state.
Rollout Resource : A custom resource compatible with native Deployments but with extra fields for advanced strategies.
Old and New ReplicaSets : Standard ReplicaSet objects with additional metadata for version tracking.
Ingress/Service : Standard Kubernetes Service resources with extra metadata to route traffic between versions; supports multiple services during a rollout.
Analysis & AnalysisRun : Custom resources that connect a Rollout to metric providers, define thresholds, and decide success or failure, optionally pausing the rollout.
Metric Providers : Native integrations with popular providers (Prometheus, Datadog, New Relic, etc.) used in Analysis.
CLI & UI : Optional kubectl plugin and UI for visualizing and managing Rollouts.
Installation
Install Argo Rollouts with the following commands:
➜ ~ kubectl create namespace argo-rollouts
➜ ~ kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/download/v1.0.2/install.yamlThis creates the argo-rollouts namespace where the controller runs.
➜ ~ kubectl get pods -n argo-rollouts
NAME READY STATUS RESTARTS AGE
argo-rollouts-6fdcf89f7c-7z2mh 1/1 Running 0 58sInstall the kubectl plugin (macOS example):
➜ ~ brew install argoproj/tap/kubectl-argo-rolloutsOr install manually with curl:
➜ ~ curl -LO https://github.com/argoproj/argo-rollouts/releases/download/v1.0.2/kubectl-argo-rollouts-darwin-amd64
➜ ~ chmod +x ./kubectl-argo-rollouts-darwin-amd64
➜ ~ sudo mv ./kubectl-argo-rollouts-darwin-amd64 /usr/local/bin/kubectl-argo-rollouts
➜ ~ kubectl argo rollouts versionUsage Examples
1. Deploy a Rollout
Create a Rollout with a canary strategy that initially sends 20% of traffic to the canary version and then pauses for manual promotion:
# basic-rollout.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
replicas: 5 # define 5 replicas
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: 5mCreate a corresponding Service:
# basic-service.yaml
apiVersion: v1
kind: Service
metadata:
name: rollouts-demo
spec:
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: rollouts-demo ➜ ~ kubectl apply -f basic-rollout.yaml
➜ ~ kubectl apply -f basic-service.yamlWatch the rollout:
➜ ~ kubectl argo rollouts get rollout rollouts-demo --watch2. Update a Rollout
Change the container image to a new version (e.g., yellow ) using the plugin:
➜ ~ kubectl argo rollouts set image rollouts-demo \
rollouts-demo=argoproj/rollouts-demo:yellowThe controller follows the defined canary steps, pausing after the first 20% weight.
3. Promote a Rollout
When the rollout is paused, manually promote to the next step:
➜ ~ kubectl argo rollouts promote rollouts-demoUse --full to skip remaining steps and analyses.
4. Abort a Rollout
Deploy a new image (e.g., red ) and then abort the rollout to roll back to the stable version:
➜ ~ kubectl argo rollouts set image rollouts-demo \
rollouts-demo=argoproj/rollouts-demo:red
➜ ~ kubectl argo rollouts abort rollouts-demoAfter aborting, you can restore the previous stable image with another set image command.
Dashboard
Start a local dashboard to visualize Rollouts:
kubectl argo rollouts dashboardThen open http://localhost:3100 in a browser. The UI allows you to inspect Rollout details, view configuration, and perform actions such as restart, pause, or abort directly.
Additional Resources
The article concludes with a promotion for a "K8S Advanced Training Camp" and a QR code for further cloud‑native learning, but the technical content above provides a comprehensive guide to using Argo Rollouts for progressive delivery on Kubernetes.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.