DevOps help for Cloud Platform Engineers
  • Welcome!
  • Quick Start Guide
  • About Me
  • CV
  • Contribute
  • ๐Ÿง DevOps & SRE Foundations
    • DevOps Overview
      • Engineering Fundamentals
      • Implementing DevOps Strategy
      • DevOps Readiness Assessment
      • Lifecycle Management
      • The 12 Factor App
      • Design for Self Healing
      • Incident Management Best Practices (2025)
    • SRE Fundamentals
      • Toil Reduction
      • System Simplicity
      • Real-world Scenarios
        • AWS VM Log Monitoring API
    • Agile Development
      • Team Agreements
        • Definition of Done
        • Definition of Ready
        • Team Manifesto
        • Working Agreement
    • Industry Scenarios
      • Finance and Banking
      • Public Sector (UK/EU)
      • Energy Sector Edge Computing
  • DevOps Practices
    • Platform Engineering
    • FinOps
    • Observability
      • Modern Practices
  • ๐Ÿš€Modern DevOps Practices
    • Infrastructure Testing
    • Modern Development
    • Database DevOps
  • ๐Ÿ› ๏ธInfrastructure as Code (IaC)
    • Terraform
      • Cloud Integrations - Provider-specific implementations
        • Azure Scenarios
          • Azure Authetication
            • Service Principal
            • Service Principal in block
            • Service Principal in env
        • AWS Scenarios
          • AWS Authentication
        • GCP Scenarios
          • GCP Authentication
      • Testing and Validation
        • Unit Testing
        • Integration Testing
        • End-to-End Testing
        • Terratest Guide
      • Best Practices
        • State Management
        • Security
        • Code Organization
        • Performance
      • Tools & Utilities - Enhancing the Terraform workflow
        • Terraform Docs
        • TFLint
        • Checkov
        • Terrascan
      • CI/CD Integration - Automating infrastructure deployment
        • GitHub Actions
        • Azure Pipelines
        • GitLab CI
    • Bicep
      • Getting Started - First steps with Bicep [BEGINNER]
      • Template Specs
      • Best Practices - Guidelines for effective Bicep implementations
      • Modules - Building reusable components [INTERMEDIATE]
      • Examples - Sample implementations for common scenarios
      • Advanced Features
      • CI/CD Integration - Automating Bicep deployments
        • GitHub Actions
        • Azure Pipelines
  • ๐Ÿ’ฐCost Management & FinOps
    • Cloud Cost Optimization
  • ๐ŸณContainers & Orchestration
    • Containerization Overview
      • Docker
        • Dockerfile Best Practices
        • Docker Compose
      • Kubernetes
        • CLI Tools - Essential command-line utilities
          • Kubectl
          • Kubens
          • Kubectx
        • Core Concepts
        • Components
        • Best Practices
          • Pod Security
          • Security Monitoring
          • Resource Limits
        • Advanced Features - Beyond the basics [ADVANCED]
          • Service Mesh
            • Istio
            • Linkerd
          • Ingress Controllers
            • NGINX
            • Traefik
            • Kong
            • Gloo Edge
            • Contour
        • Tips
          • Status in Pods
          • Resource handling
          • Pod Troubleshooting Commands
        • Enterprise Architecture
        • Health Management
        • Security & Compliance
        • Virtual Clusters
      • OpenShift
  • Service Mesh & Networking
    • Service Mesh Implementation
  • Architecture Patterns
    • Data Mesh
    • Multi-Cloud Networking
    • Disaster Recovery
    • Chaos Engineering
  • Edge Computing
    • Implementation Guide
      • Serverless Edge
      • IoT Edge Patterns
      • Real-Time Processing
      • Edge AI/ML
      • Security Hardening
      • Observability Patterns
      • Network Optimization
      • Storage Patterns
  • ๐Ÿ”„CI/CD & GitOps
    • CI/CD Overview
      • Continuous Integration
      • Continuous Delivery
        • Deployment Strategies
        • Secrets Management
        • Blue-Green Deployments
        • Deployment Metrics
        • Progressive Delivery
        • Release Management for DevOps/SRE (2025)
      • CI/CD Platforms - Tool selection and implementation
        • Azure DevOps
          • Pipelines
            • Stages
            • Jobs
            • Steps
            • Templates - Reusable pipeline components
            • Extends
            • Service Connections - External service authentication
            • Best Practices for 2025
            • Agents and Runners
            • Third-Party Integrations
            • Azure DevOps CLI
          • Boards & Work Items
        • GitHub Actions
        • GitLab
          • GitLab Runner
          • Real-life scenarios
          • Installation guides
          • Pros and Cons
          • Comparison with alternatives
      • GitOps
        • Modern GitOps Practices
        • GitOps Patterns for Multi-Cloud (2025)
        • Flux
          • Overview
          • Progressive Delivery
          • Use GitOps with Flux, GitHub and AKS
  • Source Control
    • Source Control Overview
      • Git Branching Strategies
      • Component Versioning
      • Kubernetes Manifest Versioning
      • GitLab
      • Creating a Fork
      • Naming Branches
      • Pull Requests
      • Integrating LLMs into Source Control Workflows
  • โ˜๏ธCloud Platforms
    • Cloud Strategy
      • AWS to Azure
      • Azure to AWS
      • GCP to Azure
      • AWS to GCP
      • GCP to AWS
    • Azure
      • Best Practices
        • Azure Best Practices Overview
        • Azure Architecture Best Practices
        • Azure Naming Standards
        • Azure Tags
        • Azure Security Best Practices
      • Landing Zones
      • Services
        • Azure Active Directory (AAD)
        • Azure Monitor
        • Azure Key Vault
        • Azure Service Bus
        • Azure DNS
        • Azure App Service
        • Azure Batch
        • Azure Machine Learning
        • Azure OpenAI Service
        • Azure Cognitive Services
        • Azure Kubernetes Service (AKS)
        • Azure Databricks
        • Azure SQL Database
      • Monitoring
      • Administration Tools - Platform management interfaces
        • Azure PowerShell
        • Azure CLI
      • Tips & Tricks
    • AWS
      • Authentication
      • Best Practices
      • Tips & Tricks
      • Services
        • AWS IAM (Identity and Access Management)
        • Amazon CloudWatch
        • Amazon SNS (Simple Notification Service)
        • Amazon SQS (Simple Queue Service)
        • Amazon Route 53
        • AWS Elastic Beanstalk
        • AWS Batch
        • Amazon SageMaker
        • Amazon Bedrock
        • Amazon Comprehend
    • Google Cloud
      • Services
        • Cloud CDN
        • Cloud DNS
        • Cloud Load Balancing
        • Google Kubernetes Engine (GKE)
        • Cloud Run
        • Artifact Registry
        • Compute Engine
        • Cloud Functions
        • App Engine
        • Cloud Storage
        • Persistent Disk
        • Filestore
        • Cloud SQL
        • Cloud Spanner
        • Firestore
        • Bigtable
        • BigQuery
        • VPC (Virtual Private Cloud)
  • ๐Ÿ”Security & Compliance
    • DevSecOps Overview
      • DevSecOps Pipeline Security
      • DevSecOps
        • Real-life Examples
        • Scanning & Protection - Automated security tooling
          • Dependency Scanning
          • Credential Scanning
          • Container Security Scanning
          • Static Code Analysis
            • Best Practices
            • Tool Integration Guide
            • Pipeline Configuration
        • CI/CD Security
        • Secrets Rotation
      • Supply Chain Security
        • SLSA Framework
        • Binary Authorization
        • Artifact Signing
      • Security Best Practices
        • Threat Modeling
        • Kubernetes Security
      • SecOps
      • Zero Trust Model
      • Cloud Compliance
        • ISO/IEC 27001:2022
        • ISO 22301:2019
        • PCI DSS
        • CSA STAR
      • Security Frameworks
      • SIEM and SOAR
  • Security Architecture
    • Zero Trust Implementation
      • Identity Management
      • Network Security
      • Access Control
  • ๐Ÿ”Observability & Monitoring
    • Observability Fundamentals
      • Logging
      • Metrics
      • Tracing
      • Dashboards
      • SLOs and SLAs
      • Observability as Code
      • Pipeline Observability
  • ๐ŸงชTesting Strategies
    • Testing Overview
      • Modern Testing Approaches
      • End-to-End Testing
      • Unit Testing
      • Performance Testing
        • Load Testing
      • Fault Injection Testing
      • Integration Testing
      • Smoke Testing
  • ๐Ÿค–AI Integration
    • AIops Overview
      • Workflow Automation
      • Predictive Analytics
      • Code Quality
  • ๐Ÿง AI & LLM Integration
    • Overview
      • Claude
        • Installation Guide
        • Project Guides
        • MCP Server Setup
        • LLM Comparison
      • Ollama
        • Installation Guide
        • Configuration
        • Models and Fine-tuning
        • DevOps Usage
        • Docker Setup
        • GPU Setup
        • Open WebUI
      • Copilot
        • Installation Guide
        • VS Code Integration
        • CLI Usage
      • Gemini
        • Installation Guides - Platform-specific setup
          • Linux Installation
          • WSL Installation
          • NixOS Installation
        • Gemini 2.5 Features
        • Roles and Agents
        • NotebookML Guide
        • Cloud Infrastructure Deployment
        • Summary
  • ๐Ÿ’ปDevelopment Environment
    • DevOps Tools
      • Operating Systems - Development platforms
        • NixOS
          • Install NixOS: PC, Mac, WSL
          • Nix Language Deep Dive
          • Nix Language Fundamentals
            • Nix Functions and Techniques
            • Building Packages with Nix
            • NixOS Configuration Patterns
            • Flakes: The Future of Nix
          • NixOS Generators: Azure & QEMU
        • WSL2
          • Distributions
          • Terminal Setup
      • Editor Environments
      • CLI Tools
        • Azure CLI
        • PowerShell
        • Linux Commands
          • SSH - Secure Shell)
            • SSH Config
            • SSH Port Forwarding
        • Linux Fundametals
        • Cloud init
          • Cloud init examples
        • YAML Tools
          • How to create a k8s yaml file - How to create YAML config
          • YQ the tool
  • ๐Ÿ“šProgramming Languages
    • Python
    • Go
    • JavaScript/TypeScript
    • Java
    • Rust
  • Platform Engineering
    • Implementation Guide
  • FinOps
    • Implementation Guide
  • AIOps
    • LLMOps Guide
  • Should Learn
    • Should Learn
    • Linux
      • Commands
      • OS
      • Services
    • Terraform
    • Getting Started - Installation and initial setup [BEGINNER]
    • Cloud Integrations
    • Testing and Validation - Ensuring infrastructure quality
      • Unit Testing
      • Integration Testing
      • End-to-End Testing
      • Terratest Guide
    • Best Practices - Production-ready implementation strategies
      • State Management
      • Security
      • Code Organization
      • Performance
    • Tools & Utilities
    • CI/CD Integration
    • Bicep
    • Kubernetes
      • kubectl
    • Ansible
    • Puppet
    • Java
    • Rust
    • Azure CLI
  • ๐Ÿ“–Documentation Best Practices
    • Documentation Strategy
      • Project Documentation
      • Release Notes
      • Static Sites
      • Documentation Templates
      • Real-World Examples
  • ๐Ÿ“‹Reference Materials
    • Glossary
    • Tool Comparison
    • Tool Decision Guides
    • Recommended Reading
    • Troubleshooting Guide
    • Development Setup
Powered by GitBook
On this page
  • Letโ€™s try it now!
  • What is Argo Rollouts?
  • Terraform-Argo-Module
Edit on GitHub
  1. CI/CD & GitOps
  2. CI/CD Overview
  3. Continuous Delivery

Blue-Green Deployments

PreviousSecrets ManagementNextDeployment Metrics

Last updated 7 days ago

The DevOps Deployment Comedy Corner

Blue/Green Deployment Meeting:

PM:     "How's the deployment going?"
Dev:    "Well, Blue works fine..."
Ops:    "And Green is ready..."
PM:     "So we're good to switch?"
Dev:    "Theoretically..."
Ops:    "Practically..."
Both:   "Maybe we should test it one more time?"
PM:     ยฏ\_(ใƒ„)_/ยฏ

*3 hours and 15 coffee cups later*

Monitor: [99.99% uptime achieved]

Remember: In DevOps, we don't have problems, we have "unplanned learning opportunities"

Suppose we have a PaymentService:v1.0.0 (that is called Blue) running on our kubernetes cluster:

PaymentService:v1.0.0 serving the users requests

From here, the new version PaymentService:v1.1.0 (that is called Green) is deployed next to the old version without affecting its:

The new version of the application is deployed and can be tested for functionality and performance.

Once the testing results are successful, application traffic is switched from blue to green:

Letโ€™s try it now!

What is Argo Rollouts?

We use Terraform and an argo terraform module that I have implemented in order to deploy Argo products.

Terraform-Argo-Module

modules/kubernetes_modules/argo/argo_rollouts.tf

resource "helm_release" "argo_rollouts" {

  for_each = var.argo_rollouts != null ? toset(["devops"]) : toset([])
  
  name       = var.argo_rollouts.name  

  repository = "https://argoproj.github.io/argo-helm"
  chart      = "argo-rollouts"
  version    = var.argo_rollouts.version
  namespace  = "argo-rollouts"
  create_namespace = true 


  dynamic "set" {
    for_each = var.argo_rollouts.sets

    content {
        name = set.key 
        value = set.value  
    }
  }

  values = var.argo_rollouts.values 
}
```plaintext

modules/kubernetes\_modules/argo/variables.tf

```plaintext
variable "argo_rollouts" {

    type = object({
        name = string 
        sets = optional(map(string), {})
        values = optional(set(string), [])
        version = optional(string)

    })

    default = null
}
```plaintext

## Blue Green Example Project <a href="#9081" id="9081"></a>

examples/bluegreen/main.tf

```plaintext
module "argo" {

    source = "../../modules/kubernetes_modules/argo"

    argo_rollouts = {
        name = "lupass"
        version = "2.31.0"

        values = [
            yamlencode(
                {
                    dashboard = {
                        enabled = true 
                        service = {
                            type = "LoadBalancer"
                        }
                    }
                }
            )
        ]
    }
}
```plaintext

Remember to define providers.tf in order to use kubernetes and helm providers and to connect to your cluster.

```plaintext
provider "kubernetes" {
  config_path    = "~/.kube/config"

}

provider "helm" {
  kubernetes {
    config_path = "~/.kube/config"
  }
}
```plaintext

Running terraform apply, we deploy Argo Rollouts on our target cluster.

## Deploy Application to test blue green deployment <a href="#7f9d" id="7f9d"></a>

To obtain the advanced deployments capabilities, we need to specify our Application Manifest via Argo Rollout CRD: Rollout. It is the same of Kubernetes deployments plus a strategy block with which you can define your deployment strategy:

```plaintext


resource "kubernetes_namespace" "my_app" {

    metadata  {
        name = "my-app"
    }
}

resource "kubernetes_manifest" "super_hello" {

  manifest = {
    apiVersion = "argoproj.io/v1alpha1"
    kind = "Rollout"
    metadata = {
      name = "super-hello"
      namespace = kubernetes_namespace.my_app.metadata.0.name 

    }

    spec = {
        replicas = 3
        revisionHistoryLimit = 6
        selector = {
            matchLabels = {
                "app" = "super-hello"
            }
        }
        template = {
            metadata = {
                labels = {
                    "app" = "super-hello"
                }
            }
            spec = {
                containers = [
                    {
                        name = "super-hello"
                        image = "ghcr.io/gbaeke/super:1.0.2"
                        env = [
                            {
                                name = "WELCOME"
                                value = "VERSION V2"
                            }
                        ]
                        imagePullPolicy = "Always"
                        resources = {
                            requests = {
                                memory = "128Mi"
                                cpu = "50m"
                            }
                            limits = {
                                memory = "128Mi"
                                cpu = "50m"
                            }
                        }
                        readinessProbe = {
                            httpGet = {
                                path = "/healthz"
                                port = "8080"
                                initialDelaySeconds = 3
                                periodSeconds = 3
                            }
                        }
                    }
                ]
            }
        }
        strategy = {
            blueGreen = {
                activeService = kubernetes_service_v1.blue_green_prod.metadata.0.name
                previewService = kubernetes_service_v1.blue_green_preview.metadata.0.name
                autoPromotionEnabled = false 
            }
        }
    }


  }

  field_manager {
    force_conflicts = true 
  }

}

resource "kubernetes_service_v1" "blue_green_prod" {

    metadata {
        name = "super-hello-prod"
        namespace = kubernetes_namespace.my_app.metadata.0.name 
    }

    spec {
        selector = {
          "app" = "super-hello"    
        }

        port {
            port = 8088
            target_port = 8080
        }
        type = "LoadBalancer"
    }
  lifecycle {
        ignore_changes = [
            metadata.0.annotations["argo-rollouts.argoproj.io/managed-by-rollouts"],
            spec.0.selector["rollouts-pod-template-hash"],
        ]
    }
}


resource "kubernetes_service_v1" "blue_green_preview" {

    metadata {
        name = "super-hello-preview"
        namespace = kubernetes_namespace.my_app.metadata.0.name 
    }

    spec {
        selector = {
          "app" = "super-hello"    
        }

        port {
            port = 8089
            target_port = 8080
        }
        type = "LoadBalancer"
    }
  lifecycle {
        ignore_changes = [
            metadata.0.annotations["argo-rollouts.argoproj.io/managed-by-rollouts"],
            spec.0.selector["rollouts-pod-template-hash"],
        ]
    }
}
```plaintext

After that we have (_**for simplicity we draw only one pod in the image**_):

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*KGvAunBfQhFebXbNr29hdQ.png" alt="" height="372" width="700"><figcaption></figcaption></figure>

kubectl get all -n my-app

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*DbrGL1KrsVKqLbap5C-MUg.png" alt="" height="191" width="700"><figcaption></figcaption></figure>

The SVC **suer-hello-prod** (and **BalancerProd**) is used for production traffic, instead of **super-hello-preview (**and **Balancer Preview)** that can be used in order to test future updates by Developers/Testers/SRE/...

If we do a HTTP GET request to BalancerProd:

```plaintext
curl http://192.168.93.140:8088 && echo
VERSION V2
```plaintext

And also it is exposed on preview side via BalancerPreview:

```plaintext
curl http://192.168.93.140:8089 && echo
VERSION V2
```plaintext

To see the status of our application , there is also

kubectl argo rollouts get rollout bluegreen-demo -n my-app โ€” watch:

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*mZ6ktHZY70j6X6KdFl-uiA.png" alt="" height="370" width="700"><figcaption></figcaption></figure>

From Argo Rollout Dashboard UI:

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*opGhPq9W8Kg1-ySV0IZLIA.png" alt="" height="505" width="700"><figcaption></figcaption></figure>

Now, we update our manifest setting MESSAGE env variable with value โ€œVERSION V3โ€

_N.B: The image tag remains the same (1.0.2), but what we change is the MESSAGE that returns (from V2 to V3). But itโ€™s the same if we change the tag version._

At this point, the Argo Rollout detect the changes and apply the strategy defined in the desired state of our Rollout Manifest.

As we can see, now we have this situation:

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*7QZx_VjJQtfo63WFg93Ngg.png" alt="" height="372" width="700"><figcaption></figcaption></figure>

kubectl argo rollouts get rollout super-hello -n my-app โ€” watch

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*IlQ_K-ZqKGUvjr3k4-DjTw.png" alt="" height="461" width="700"><figcaption></figcaption></figure>

Argo Rollouts Dashboard UI

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*XIC_ZB2xSmThzVZouSePYw.png" alt="" height="368" width="700"><figcaption></figcaption></figure>

k get all -n my-app

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*Th-1eCSWzTyoAKfRkTa94w.png" alt="" height="254" width="700"><figcaption></figcaption></figure>

curl BalancerProd

```plaintext
 curl http://192.168.93.140:8088 && echo
VERSION V2
```plaintext

curl BalancerPreview

```plaintext
curl http://192.168.93.140:8089 && echo
VERSION V3
```plaintext

Once tested the functionality and the performance of super-hello:V3, we can promote the rollout and so switching to use super-hello:V3 in production:

```plaintext
> kubectl argo rollouts promote super-hello
rollout 'super-hello' promoted
```plaintext

So we have:

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*07NKNjdmFVE8_C4sSG1UxA.png" alt="" height="372" width="700"><figcaption></figcaption></figure>

kubectl argo rollouts get

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*4ckgtl-nNS4gXCdfWD5cTw.png" alt="" height="445" width="700"><figcaption></figcaption></figure>

Argo Rollouts Dashboard UI

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*xNv3TCaSGZD-TtVhDokzuQ.png" alt="" height="318" width="700"><figcaption></figcaption></figure>

k get all -n my-app

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*NyNw7Om8-S2ymWxVj6YMMQ.png" alt="" height="209" width="700"><figcaption></figcaption></figure>

curl BalancerProd

```plaintext
curl http://192.168.93.140:8088 && echo
VERSION V3
```plaintext

curl BalancerPreview

```plaintext
curl http://192.168.93.140:8089 && echo
VERSION V3
```plaintext

Finaly, the old super-hello:V2 is destroyed:

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*xITtkmUPB1bZROJth1gZxw.png" alt="" height="372" width="700"><figcaption></figcaption></figure>

This way you can minimize downtime possibilities by ensuring service availability during updates. In contrast to blue-green deployments, there are canary deployments that allow a gradual upgrade between versions.
PaymentService:v1.1.0 is deployed next to the old version without affecting its
Green then becomes the new production

๐Ÿ”„
Argo Rollouts is a Kubernetes controller and set of CRDs which provide advanced deployment capabilities such as blue-green, canary, canary analysis, experimentation, and progressive delivery features to Kubernetes.