ElenaiNIn Blog

Where ideas become digital art

Zero Downtime Deployment Patterns

Technical implementation of canary deployments using container orchestration platforms with real-world code examples and architecture diagrams.

Blue/Green Deployment

Infrastructure Architecture

Parallel environments allow safe deployment to staging while maintaining active production instances.

Deployment Architecture

Kubernetes Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: green-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
      color: green
  template:
    metadata:
      labels:
        app: web
        color: green
    spec:
      containers:
      - name: app
        image: myapp:1.2.3
        ports:
        - containerPort: 80

Canary Deployments

Gradual Routing

Route small percentage of traffic to new version, scale based on monitoring metrics.

5% → New version v2
95% → Stable version v1

Implementation Steps

  1. 01 Deploy new version alongside existing infrastructure
  2. 02 Route 5-10% traffic to canary version
  3. 03 Monitor performance metrics (latency, error rate, etc)
  4. 04 Scale to 100% if stable or roll back on failure

Argo Rollouts

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: canary-rollout
spec:
  strategy:
    canary:
      steps:
      - setWeight: 5
        pause: {}
      - setWeight: 100
      trafficSplit:
        stableMetadata:
          includeInGlobalName: true
        serviceName: canary-service

Deployment Simulation

Deployment Settings

5%

Deployment Monitor

v1 (Stable)

95% traffic

v2 (Canary)

5% traffic

Recommended Reading

Microservices Patterns

Architectural patterns for building resilient, scalable microservices architectures.

Read more →

Container Security

Secure container deployment practices with vulnerability scanning and runtime protection.

Read more →

CD Pipeline Design

Optimizing continuous delivery pipelines with feature flags and automated testing.

Read more →