Release strategies: rolling, blue-green, canary and feature flags
Ways to put a new version in front of users with less risk, how each one rolls back, and what each costs.
A rolling update replaces old copies with new ones a few at a time; it's Kubernetes' default and needs no extra capacity, but both versions serve users during the change. Blue-green runs the new version beside the old one and switches all traffic at once; rollback is switching back, at the cost of double capacity for a while.
A canary sends a small share of traffic (1%, then 10%, then all) to the new version while you watch error rates and latency, and stops at the first sign of trouble. Feature flags separate deploying code from releasing a feature: the code ships switched off and is turned on for chosen users later, so you can turn a feature off without deploying.
Whatever the strategy, rollback must be automatic or at least one command, and tested. Database changes need care: make them backward compatible (expand, then contract) so the old version still works if you roll back.
Cost. Free to practise on kind or in a public repository. In Azure, blue-green doubles capacity during a release, which costs more for that time.
Use it when
- you're choosing how to release a service.
- a release went wrong and rollback was slow.
- you want to test a feature with a few users first.
How it works
- Rolling
- Replace pods gradually; Kubernetes default.
- Blue-green
- Two full versions, switch traffic at once.
- Canary
- A small share of traffic first, watched closely.
- Feature flags
- Ship off, switch on later.
- Rollback
- Automatic on failed checks, practised regularly.
Options
- Rolling
- Simple, no extra cost, both versions live briefly.
- Blue-green
- Instant switch and rollback, double capacity.
- Canary
- Smallest blast radius, needs good metrics.
- Feature flags
- Finest control, needs flag clean-up discipline.
Example. Kestwick Hotels releases its booking engine as a canary: 5% of traffic for 15 minutes, then 50%, then all. An automated check compares error rates; twice this year it stopped a release at 5%, and most guests never noticed.
Don't confuse it with
- Deploy
- Putting new code into an environment.
- Release
- Letting users see a change.
Words to know
- Blast radius
- How many users a bad change can affect.
- Expand and contract
- Changing a database in backward-compatible steps.
- Feature flag
- A switch that turns a feature on or off without deploying.
Where to look
- Kubernetes
- Azure Container Apps revisions
- App Service slots
- Azure App Configuration
Practise it
- Deploy to Kubernetes and roll back on failureHow-to, Free
- Canary releases with revisions and traffic splitsHow-to, Costs money
- Blue-green releases with deployment slotsHow-to, Costs money
- Feature flags with App ConfigurationHow-to, Free tier
- Roll out and roll back safelyHow-to, Costs money
Read it in the guide, next to the tasks and labs.
Open in DevOps, Hands On