Question presented to candidate:
"What are blue-green and canary deployments? How do they differ from a normal rolling update, and when would you pick each one?"
What a strong answer should cover:
Blue-green: two full environments; deploy and test the idle one, switch all traffic at once, switch back to roll back. Fast, all-or-nothing, needs double capacity during the switch
Canary: send a small, growing share of real traffic to the new version, compare its metrics with the old version (the control), and promote or roll back automatically. Small blast radius, slower rollout
Rolling update as the baseline (replace instances a few at a time, as a Kubernetes Deployment does by default) and why its rollback is slow and its mixed fleet still hits everyone
What makes canaries work: sticky assignment of users, enough traffic for a statistically meaningful comparison, automated analysis gates, and metrics that capture the user experience (errors, latency, business KPIs)
The parts that break both: database schema changes (expand and contract), long-lived connections and sessions, background jobs and queues, and why feature flags complement deployments
Code / implementation expected: Optional โ a simulation of a bad release under blue-green, rolling and canary, counting failed requests before rollback; the example does that, and shows a naive canary gate blocking a good release.
deployment
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Beginners to release engineering โ you know what a server, a load balancer and a deploy are; every term is defined as we go.
Difficulty: Medium
Verified with: Node 22.22 and Python 3.12 (both print identical output). Kubernetes defaults are from the Kubernetes Deployment API reference; the canary definition is from the Google SRE Workbook, chapter 16, checked in October 2026.
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the exact words an interviewer expects. The numbers in section 5 come from the example program; the Verified section quotes its full output.
1. Why This Even Matters โ A Story First
A restaurant changes its menu. There are three ways to do it.
Swap the whole menu at Friday dinner. If the new curry is terrible, every table that night gets i
The solution is hidden so you can try first
14 min read ยท 13 sections
4
Read the code
Blue-green vs rolling vs canary: blast radius of a bad release and the cost of a noisy canary gate