0Pricing
DevOps Bootcamp · Lesson

Deployment Strategies: Blue-Green and Canary

Go beyond rolling updates and learn how to release safely with blue-green and canary deployment patterns in Kubernetes.

Deployment Strategies: Blue-Green and Canary is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why More Than Rolling Updates?

Rolling updates replace Pods gradually, but they mix old and new versions during the transition. For risky releases you may want full control over which users see the new version.

Blue-green and canary strategies give you that control.

The Blue-Green Idea

In a blue-green deployment you run two identical environments:

  • Blue = current live version
  • Green = new version, fully deployed but not yet receiving traffic

You flip traffic from blue to green all at once.

Two Deployments, One Service

Each version is its own Deployment with a version label. A single Service selects whichever color is live.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-blue
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
      version: blue
  template:
    metadata:
      labels:
        app: web
        version: blue
    spec:
      containers:
      - name: web
        image: myapp:1.0

Switching Traffic

To go live with green, you simply patch the Service selector to point at the green version. The cutover is instant.

kubectl patch service web -p '{"spec":{"selector":{"app":"web","version":"green"}}}'

Blue-Green Pros and Cons

  • Pro: instant rollback by switching back to blue
  • Pro: no version mixing during release
  • Con: needs double the resources during the overlap

The Canary Idea

A canary release sends a small slice of traffic to the new version first. If metrics look healthy, you scale it up gradually.

The name comes from canaries that miners used to detect danger early.

Canary with Replica Counts

A simple canary uses two Deployments sharing the same Service label. Traffic splits roughly by replica ratio.

# stable: 9 replicas, canary: 1 replica => ~10% to canary
kubectl scale deployment app-stable --replicas=9
kubectl scale deployment app-canary --replicas=1

Promoting a Canary

As confidence grows you shift the ratio toward the canary, then retire the old version once it serves all traffic.

kubectl scale deployment app-canary --replicas=5
kubectl scale deployment app-stable --replicas=5
# later, fully promote
kubectl scale deployment app-canary --replicas=10
kubectl scale deployment app-stable --replicas=0

Observing the Canary

The whole point of a canary is observation. Watch error rates, latency, and logs before promoting.

kubectl get pods -l version=canary
kubectl logs -l version=canary --tail=50

Choosing a Strategy

  • Blue-green: best when you want a clean, instant cutover and quick rollback
  • Canary: best when you want to limit blast radius and validate with real traffic
  • Rolling: good default for low-risk, routine updates

Tooling Beyond kubectl

For fine-grained traffic splitting (e.g. exactly 5%), teams use service meshes like Istio or progressive-delivery tools such as Argo Rollouts and Flagger, which automate canary analysis.

Quick Check

Pick the statement that best describes a canary release.

Recap

You compared advanced release strategies. Blue-green flips all traffic instantly between two environments for fast rollback, while canary gradually shifts traffic to limit risk. Both build on the Deployment and Service primitives you already know.

Frequently asked questions

Is the “Deployment Strategies: Blue-Green and Canary” lesson free?

Yes — the full text of “Deployment Strategies: Blue-Green and Canary” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.

What will I learn in “Deployment Strategies: Blue-Green and Canary”?

Go beyond rolling updates and learn how to release safely with blue-green and canary deployment patterns in Kubernetes. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Deployment Strategies: Blue-Green and Canary” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Understanding Deployments
  2. Scaling Applications with ReplicaSets
  3. Rolling Updates and Rollbacks
  4. Deployment Strategies: Blue-Green and Canary
← Back to DevOps Bootcamp