Blue/Green

Definition

Blue/Green deployment is a release management strategy that reduces downtime and risk by running two identical production environments, referred to as “Blue” and “Green.” At any given time, one environment is live, serving all production traffic, while the other is idle. When deploying a new version of an application, the idle environment is updated and tested before switching traffic over, allowing for quick rollback if issues arise.

Secure Settings Example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-green
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app-container
        image: my-app:latest
        ports:
        - containerPort: 80
        securityContext:
          runAsNonRoot: true
          readOnlyRootFilesystem: true

Insecure Settings Example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-blue
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app-container
        image: my-app:latest
        ports:
        - containerPort: 80
        securityContext:
          runAsNonRoot: false
          readOnlyRootFilesystem: false