Choosing a deployment strategy means deciding how to replace a version in production with the next one without breaking the service. This page gives the complete overview of the methods used in 2026: recreate, rolling update, blue-green, canary, shadow, feature flags and progressive delivery. For each one, you will see the principle, a concrete example, and its strengths and limits. It is for beginner or intermediate developers and ops who want to stop deploying blind. You will also find a decision matrix and the real hard part of the topic: database migrations.
What you will learn
- Distinguish the main families of strategies and their exact vocabulary.
- Choose the method suited to your downtime, your budget and your observability.
- Tell a technical canary apart from a product A/B test.
- Handle a schema migration without interruption with the expand-contract pattern.
- Equip your rollouts with Kubernetes, Argo Rollouts, Flagger or Spinnaker.
- Avoid the classic anti-patterns that turn a deployment into an incident.
Recreate (Big Bang): stop then restart, accepted downtime
The recreate strategy, also called Big Bang, stops all the instances of the old version, then starts the new one. In between, the application is unavailable. It is the simplest method to understand and operate, because there are never two versions in parallel: no risk of mixed behaviour, no compatibility constraint between old and new instances.
The price to pay is a downtime proportional to the startup time. Take an internal billing tool used only during the day: deploying it at 3 am with a recreate costs a few minutes of unavailability that nobody notices. On the other hand, applying a recreate to an online shop in the middle of the day means showing an error page to every customer during the restart. Reserve this strategy for non-critical applications, test environments, or cases where a heavy migration forbids two versions from coexisting anyway.
Rolling update: progressive replacement in batches
The rolling update replaces instances in small batches rather than all at once. Kubernetes is the orchestrator that runs your containers as pods. It creates a batch of new pods and waits until they are ready. It then removes some old pods, and starts again until the whole fleet runs the new version. The maxSurge and maxUnavailable parameters, described below, bound the number of extra pods and of unavailable pods during the operation.
It is the default strategy of a Kubernetes Deployment, the object that describes how many pods of an application must run. It offers a deployment without interruption as long as the application tolerates two versions running side by side for a few minutes.
Two parameters drive the pace. The maxUnavailable parameter sets how many pods may be missing during the operation, and maxSurge how many extra pods may be created above the desired number. Their default value is 25% each, expressible as an absolute number (for example 2) or as a percentage. They cannot both be zero at the same time, otherwise Kubernetes would have no margin to progress. For a service with 8 replicas, maxSurge: 2 and maxUnavailable: 0 guarantee that no capacity is lost during the update, at the cost of two temporary extra pods.
The rolling update has a weakness: during the transition, users hit the old or the new version indiscriminately. If the new one is buggy, the regression spreads progressively, and rolling back means running a reverse rolling update, which takes time. For the details of the parameters, progressDeadlineSeconds and rollbacks, see the guide on Kubernetes rolling updates and rollbacks.
Blue-Green: two identical environments, instant switch
Blue-green consists in maintaining two complete and identical environments. Blue serves production, green receives the new version. Once green is tested and validated without real traffic, you switch the router or load balancer to send 100% of the traffic to green in one go. The old blue stays up for a few hours, ready to take over the service.
The major strength is the immediate rollback: if green goes wrong, you switch back to blue in one command, without rebuilding or restarting anything. The switch being atomic, there is no window where two versions serve the same user. Imagine a banking API: you deploy v2 on green, run your end-to-end test suite against it, then switch at 9 am with confidence, with a safety net that brings you back to v1 in seconds.
The drawback is obvious: you pay a doubled infrastructure cost during the coexistence window, since two complete fleets must run. Across dozens of services, this bill is not neutral. Blue-green also assumes the database is compatible with both versions at the same time, a point covered below.
Canary: a little real traffic, then progressive widening
The canary takes its name from the canaries miners carried underground to detect gas. The new version is exposed to a small percentage of real traffic, typically 5%, while the rest stays on the old one. You watch the metrics (HTTP error rate, latency, saturation), and if all goes well you widen in steps: 5%, then 25%, 50%, finally 100%. At the slightest negative signal, you cancel and the blast radius stays tiny.
The telling example is a high-traffic site. You route 5% of visitors to v2 of a search microservice. After ten minutes, the 500 error rate of v2 is comparable to v1 and the p99 latency stays under your threshold: you go up to 25%. If instead errors climb, only 5% of users were affected, and you cut. The canary thus limits the blast radius of a bad version far better than a rolling update.
In return, the canary requires fine traffic routing (through a service mesh, a network layer that routes requests between services, or an ingress able to weight traffic) and above all an observability able to tell, within minutes, whether the new version behaves well. Without reliable metrics, a canary is just a disguised rolling update. To lay the foundations of this monitoring, rely on the observability guide and on the SLOs, SLIs and error budgets that provide the decision thresholds.
A/B testing: routing by cohort for a product decision
A/B testing technically resembles the canary, but its goal is radically different. Here you are not trying to validate that a version does not regress, you are trying to find out which functional variant performs best with users. You route cohorts (by country, by segment, by random draw) to variants A and B that offer, for example, two different labels for the buy button.
The distinction is crucial. The canary watches system metrics and aims at a technical decision to go to production. A/B testing watches business metrics such as the conversion rate or the average basket, and aims at a product decision carried by the marketing or product teams. An A/B test can last weeks to reach statistical significance, whereas a canary concludes in minutes. Confusing the two leads to bad decisions: you don't cut a variant because it has 0.1% more errors, you cut it because it converts worse.
Shadow / dark traffic: duplicating without user impact
Shadow traffic (or dark traffic) consists in duplicating production traffic to the new version, without ever sending its responses back to users. v1 really answers, while v2 receives a copy of the requests and works in the shadows. You then compare the responses and the performance of both versions on real traffic, without exposing a single customer to the risk.
It is ideal to validate a heavy rewrite. Suppose you replace a recommendation engine with a rewritten version: shadow lets you check that v2 holds the production load and returns consistent results, before entrusting it with any customer. The major pitfall concerns writes. If the duplicated request triggers a card charge, an email or a database insert, shadow causes real side effects twice. You must therefore either stick to read-only calls, or redirect v2's writes to an isolated database or mocks.
Feature flags / dark launching: decoupling deployment and activation
Feature flags (or feature toggles) are switches in the code that enable or disable a feature without redeploying. The principle moves the cursor: deploying code and activating a feature become two distinct steps. We speak of dark launching when a feature is shipped to production switched off, ready to be turned on for a fraction of users when the team decides.
The gain is on risk. You merge and deploy unfinished code behind a disabled flag, without ever exposing it. On launch day, you enable the feature for 1% of internal accounts, then for everyone, through a simple configuration change. If there is a problem, you switch off the flag in seconds, which is a logical rollback far faster than a redeployment. This technique fits naturally with Git workflows (in French) based on short branches, since it lets you integrate often without waiting for a feature to be finished.
Progressive delivery: automated canary with rollback on metrics
Progressive delivery is the automated culmination of the canary. It combines a canary deployment, feature flags and above all an automatic rollback driven by metrics analysis. Instead of a human watching a dashboard and deciding to widen or cut, a controller applies a declarative strategy: it raises the traffic in steps, queries Prometheus, the metrics system, at each step, and cancels on its own if the error rate exceeds the threshold.
Two tools do this on Kubernetes. Argo Rollouts brings a custom Rollout resource, which replaces the Deployment or references it through its workloadRef field, and in which you describe the steps (setWeight: 5, pause, analysis, setWeight: 25) and the analysis queries. Flagger takes the opposite approach: it drives your existing Deployments without changing your manifests, relying on a service mesh or an ingress to split the traffic, and it automates analysis and promotion. The common result is a rollout that governs itself: a detected regression triggers a rollback before a human has even opened their screen.
How to choose your strategy: decision matrix
No strategy is universally superior. The right choice depends on your context, which can be reduced to five questions: what downtime can I tolerate, what rollback speed do I need, what infrastructure cost can I pay, is my application stateful or stateless, and what observability do I really have in place. Read the matrix as a filter: start from the strongest constraint for your service, it often eliminates half of the options.
| Strategy | Downtime | Rollback | Infra cost | Stateful | Observability required |
|---|---|---|---|---|---|
| Recreate | Yes | Slow | Low | Tolerated | Low |
| Rolling update | No | Medium | Low | Sensitive | Medium |
| Blue-Green | No | Instant | Doubled | Sensitive | Medium |
| Canary | No | Fast | Moderate | Sensitive | High |
| Progressive delivery | No | Automatic | Moderate | Sensitive | Very high |
Concretely, an internal tool with no stakes is fine with a nightly recreate. A standard public API starts very well with a rolling update, the Kubernetes default. A critical service with a requirement to roll back in seconds justifies blue-green despite its cost. A high-traffic product with mature observability gains from moving to canary, then to progressive delivery. The stateful mention recalls that an application with state, a database or a queue, complicates all these strategies, which brings us to the real hard part. These choices are then measured with the DORA metrics, notably deployment frequency and change failure rate.
The hard part: database migrations
The diagrams above hide the hard part: you don't roll back a database the way you roll back a container. If your new version removes a column and you must go back, the old version will look for a column that no longer exists. Any zero-downtime deployment strategy therefore assumes that the old and new versions of the code coexist with the same schema during the transition. The solution is to make every change backward compatible with the expand-contract pattern, also called parallel change.
The diagram shows the three steps in order, each shipped in a separate deployment. Look at the last one, Contract: it is the only one that removes something, and it comes only after the other two.
-
Expand: you add the new without touching the old. To rename an
emailcolumn tocontact_email, you createcontact_emailnext to it, without removingemail. The schema now accepts both versions of the code. -
Migrate: you deploy compatible code that writes to both columns and reads the new one, then you copy the existing data from
emailtocontact_email. At this stage, the old and new versions run without breaking. -
Contract: once all the instances have moved to the new version and the data is migrated, a later deployment finally removes the now useless
emailcolumn.
The rule to remember: never make a destructive change in the same deployment as the code that depends on it. A rename, a column removal or a type change is always split into several successive deployments, each backward compatible with the previous one. This discipline is what really makes blue-green and canary possible, because it guarantees that an application rollback never meets an incompatible schema.
Tooling
The strategies described above are not implemented by hand in production. Kubernetes natively covers recreate and rolling update through the strategy field of a Deployment, and handles rollbacks with kubectl rollout undo. It is the foundation everything else relies on, detailed in the lesson Rolling Updates and Rollbacks. For a simple, controlled rolling update, Kubernetes alone is largely enough.
As soon as you want an automated canary or a metrics-driven blue-green, you must go up a notch. Argo Rollouts introduces a declarative Rollout resource with built-in analysis, ideal if you are already on ArgoCD and GitOps. Flagger automates the same strategies by driving your existing Deployments without rewriting your manifests, and integrates well with Flux and a service mesh. Spinnaker, heavier and multi-cloud, offers blue-green and automated canary analysis through its Kayenta component, for organisations with complex deployment needs. These tools plug in downstream of a CI/CD pipeline that builds and tests the artifact before triggering the rollout.
Anti-patterns
Knowing the strategies is not enough if you repeat the classic errors that empty them of their meaning. The three below come back often in deployment incidents, and each betrays misplaced trust in automation or in luck.
The first is the Friday Big Bang. Deploying a big update at the end of the week, without a progressive strategy, concentrates the risk at the worst moment: the team leaves, the on-call engineer inherits an incident without context, and the rollback waits until Monday. Deploy early in the day and early in the week, while the people who wrote the code are still there.
The second is the canary without metrics. Routing 5% of the traffic to a new version then widening by feel, without a defined error or latency threshold, is not a canary: it is a slow rolling update that gives a false sense of security. A canary is only worth something if measurable metrics trigger the decision to widen or cut.
The third is the untested rollback. Many teams document a rollback procedure they have never run. On the day of the incident, they discover that the rollback breaks the database, that a migration is irreversible, or that the command has changed. A rollback is rehearsed regularly in pre-production, exactly as a backup is only worth something if its restore is tested.
DevSecOps exercise: prepare a verifiable rollback
This exercise applies to any team that delivers on Kubernetes, whatever the course that brings you here: it relies on a reliability alert and a rollback, two notions shared by all delivery paths.
A runbook is the sheet that says what to do when an alert fires. Take the one
for the reliability alert of the notes-api service: it must explain the
rollback before anyone has to run it under pressure. The exercise is done on
paper, with no cluster to deploy.
A useful rollback procedure is more than "relaunch the old version". It must specify the trigger signal, who may decide, the scope of the action, the prerequisites, the command suited to the environment, the expected result and the verification of the service after the operation.
For an existing Kubernetes Deployment in namespace notes-api, the basic
syntax is:
# Teaching example, to adapt to the real Deployment name and to the context.kubectl -n notes-api rollout history deployment/<deployment-name>kubectl -n notes-api rollout undo deployment/<deployment-name>kubectl -n notes-api rollout status deployment/<deployment-name>The rollout undo command requests a return to a previous Deployment
revision. It does not restore data and does not establish that the
business service is correct again. If the previous version cannot read the
current database schema, an application rollback can make the incident
worse. The person in charge must define the functional tests and the
fallback plan before relying on the command.
Putting it into practice. The alert reports an abnormal error rate on order confirmation after a deployment. Write a procedure with six components: trigger, owner, prerequisites, rollback action, functional verification and escalation condition. Specify the additional check to perform if a database migration has already run. Then compare a rollback with disabling a feature: the two strategies do not have the same prerequisites.
To check yourself alone, reread your procedure against these criteria. A good
answer names a measurable trigger (for example an error rate above a
threshold, over a given duration) and a person or a role who decides. It lists
prerequisites that can be verified before acting (previous revision available
in rollout history, compatibility of the old version with the current
database schema). It contains the sequence rollout history, rollout undo
then rollout status, and a functional verification that does not stop at
"the pods are Running" (for example replaying an order confirmation). For a
database migration that has run, it says whether it is reversible and what
happens otherwise. Finally it sets an escalation condition: whom to call, and
after how long without a return to normal.
In the DevSecOps course, the V11 lab of the end-to-end project assesses elements of such a runbook among its checks. The command shown here is not evidence of execution: this lesson prepares the task, and the lab checks part of it.
Primary source: Kubernetes, kubectl rollout undo.
Key takeaways
- A deployment strategy trades off downtime, rollback speed, infrastructure cost, statefulness and observability.
- Recreate accepts an interruption, reserved for non-critical applications.
- The rolling update is the Kubernetes default, driven by
maxSurgeandmaxUnavailable(25% each by default). - Blue-green offers an instant rollback at the price of a doubled infrastructure cost.
- Canary limits the blast radius but requires solid observability and fine traffic routing.
- A/B testing is a product decision on business metrics, not to be confused with the technical canary.
- Progressive delivery automates the canary with rollback on metrics through Argo Rollouts or Flagger.
- Database migrations require the expand-contract pattern to stay backward compatible.
Knowledge check
Check that you have the essentials of this guide. The questions only cover what has just been explained here.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Feature Flags: decoupling deployment and release
Continue the course: Kubernetes labels and annotations: kubectl label and annotate
Continue the course: GitOps: principles, ArgoCD vs Flux and implementation
A new full quiz with random questions
Work again only on the questions you missed
FAQ: frequently asked questions
The questions below cover the choices that often come up: the default strategy, the gap between canary and A/B testing, and handling database migrations.