Java

Zero Downtime Deployments with Kubernetes and Argo Rollouts

Delivering new features quickly is important, but not at the cost of application stability. In modern DevOps workflows, zero downtime deployments are a must. That’s where Kubernetes and Argo Rollouts come in — offering powerful strategies like canary and blue/green deployments along with live metrics checks for safe and seamless releases.

This article explains how to implement zero downtime deployments using Argo Rollouts on Kubernetes, with practical examples and a comparison of canary vs. blue/green strategies.

1. What is Argo Rollouts?

Argo Rollouts is a Kubernetes controller and set of CRDs (Custom Resource Definitions) that provides advanced deployment strategies:

  • Canary deployments
  • Blue/Green deployments
  • Progressive delivery
  • Traffic shaping (via service mesh or ingress)
  • Live analysis using Prometheus, Kayenta, etc.

It works as a drop-in replacement for Kubernetes Deployments.

2. Blue/Green vs. Canary: Key Differences

FeatureBlue/GreenCanary
Rollout styleDeploy full new version alongside oldGradually shift traffic to new version
Traffic switchingAll at onceIncremental (step-by-step)
RollbackQuick via switching servicesStep-level rollback possible
TestingManual or automated QA on greenReal user traffic + metric analysis
RiskMediumLow
Use CaseHigh confidence releasesLow-risk progressive testing

3. Example: Blue/Green Deployment with Argo Rollouts

1. Define the Rollout:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: my-app
spec:
  replicas: 3
  strategy:
    blueGreen:
      activeService: my-app
      previewService: my-app-preview
      autoPromotionEnabled: false
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: my-app:v2

2. Services:

apiVersion: v1
kind: Service
metadata:
  name: my-app
spec:
  selector:
    app: my-app
apiVersion: v1
kind: Service
metadata:
  name: my-app-preview
spec:
  selector:
    app: my-app
kubectl argo rollouts promote my-app

🐦 Example: Canary Deployment with Argo Rollouts

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: my-app
spec:
  replicas: 3
  strategy:
    canary:
      steps:
        - setWeight: 20
        - pause: { duration: 2m }
        - setWeight: 50
        - pause: { duration: 5m }
        - setWeight: 100
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: my-app:v2

This will:

  • Send 20% of traffic to the new version
  • Pause to monitor
  • Increase to 50%, then 100%, with pauses

4. Live Metrics Checks with Prometheus

Argo supports automated analysis using Prometheus or Kayenta. Here’s a snippet for integrating Prometheus:

analysis:
  templates:
    - name: success-rate-check
      metrics:
        - name: success-rate
          interval: 1m
          successCondition: result[0] > 0.95
          provider:
            prometheus:
              address: http://prometheus:9090
              query: |
                sum(rate(http_requests_total{status=~"2.."}[1m])) / 
                sum(rate(http_requests_total[1m]))

This automatically checks if 95%+ of requests are successful before progressing.

5. Best Practices for Zero Downtime Deployments

Always test new versions on a preview service before promoting

  • Use canary when unsure about release quality
  • Integrate automated analysis to catch issues early
  • Use progressive traffic shifting with pauses and alerts
  • Ensure rollback is fast and reliable

6. Conclusion

With Argo Rollouts, Kubernetes becomes a powerful platform for safe and zero-downtime deployments. Whether you choose blue/green for fast promotion or canary for cautious rollout, Argo gives you fine-grained control, live metric checks, and rollback capabilities to deploy confidently.

Eleftheria Drosopoulou

Eleftheria is an Experienced Business Analyst with a robust background in the computer software industry. Proficient in Computer Software Training, Digital Marketing, HTML Scripting, and Microsoft Office, they bring a wealth of technical skills to the table. Additionally, she has a love for writing articles on various tech subjects, showcasing a talent for translating complex concepts into accessible content.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Back to top button