Kubernetes Deployment Strategies

Short answer: there are seven Kubernetes deployment strategies worth knowing, and this page shows each one as an animated simulation of pods and traffic. Three are built into the Deployment controller: rolling update, ramped slow rollout and recreate. Four need a load balancer, a service mesh or a progressive-delivery tool: blue/green, canary, A/B testing and shadow. Pick a strategy, press play and watch the pods start, pass readiness and terminate while the traffic share moves. Sliders change the simulation: maxSurge and maxUnavailable for the rolling update, the canary weight and the number of promotion steps, the A/B routing rule, the mirrored share for shadow. Next to the animation sit the manifest that drives the strategy (Deployment strategy, Service selector, Gateway API or Ingress NGINX weights, Argo Rollouts, Flagger, Istio), the kubectl rollout commands to run, watch, pause and undo it, and the pros, cons and tooling. The Compare tab lines all seven up; the wizard asks five questions and recommends one. See also the CUDA Vector Addition Playground, the same play, step and replay simulator applied to NVIDIA GPU parallelism.

Prefer a full window? Open the explainer full screen →

The seven Kubernetes deployment strategies at a glance

  • 1. Rolling update (built in). Pods are replaced in batches. maxSurge sets how many extra pods may run above the replica count, maxUnavailable how many may be missing. Zero downtime, both versions serve traffic for a few minutes, rollback with kubectl rollout undo.
  • 2. Ramped slow rollout (built in). A rolling update with maxSurge 1 and maxUnavailable 0 plus minReadySeconds: one pod at a time, each one verified before the next. The first pod is a cheap canary; kubectl rollout pause and resume gate it by hand.
  • 3. Recreate (built in). All v1 pods are killed, then all v2 pods are started. Downtime for the length of image pull, startup and readiness, but never two versions at once: the strategy for incompatible schemas, singletons and ReadWriteOnce volumes.
  • 4. Blue/green. Two complete environments. Green is deployed and smoke-tested beside blue, then a Service selector patch flips all traffic at once; the same patch in reverse is the rollback. Costs double the pods during the switch. Argo Rollouts automates it.
  • 5. Canary. A chosen share of real traffic goes to v2 through weighted routing (Gateway API HTTPRoute weights, Ingress NGINX canary annotations, Istio or Linkerd). Metrics decide whether the weight grows to 100 % or drops to 0. Argo Rollouts and Flagger run the steps and the analysis.
  • 6. A/B testing. A rule, not chance, decides who sees v2: a header, a cookie or a region. The same users always get the same version, and a business metric such as conversion picks the winner.
  • 7. Shadow. Live requests are mirrored to v2 and its responses are discarded. v2 is measured under the real request mix while no user is affected. Mirrored writes are real writes, so stub the downstream systems.

How to use the Kubernetes deployment strategies explainer

  • Simulation. Play, pause, step back and forward, replay, speed. The step list under the animation explains every frame; click a step to jump to it. The sliders and selects rebuild the simulation and the manifest at once: try maxSurge 0 with maxUnavailable 0 for the rolling update, a failed check in the ramped rollout, a rollback after the blue/green switch or a failing canary analysis.
  • Manifests and commands. Every strategy shows the manifest with a copy button; canary, A/B and shadow offer variants for Gateway API, Ingress NGINX, Istio, Argo Rollouts and Flagger. The kubectl commands have a copy button and a link into the kubectl CLI Interactive Mindmap; the manifest fields link into the Kubernetes YAML Explorer.
  • Compare and choose. The Compare tab is one table: built in or not, zero downtime, real-traffic test, rollback speed, cost in pods, complexity and the tooling needed. “Which one should I use?” asks five questions (outage tolerance, version compatibility, real-user testing, rollback speed, what runs in the cluster) and ranks the seven.
  • Links. “Copy link” gives a URL such as ?s=canary that opens the page on that strategy; ?tab=compare and ?tab=wizard open the other tabs. Keys: arrows switch the strategy, Space plays and pauses, the full stop steps, R replays.

Frequently asked questions

What is the default deployment strategy in Kubernetes?

RollingUpdate with maxSurge 25 % and maxUnavailable 25 %. A Deployment without a strategy block replaces its pods in batches: up to a quarter more pods than replicas may run during the update and up to a quarter may be missing. Set both to absolute numbers for small Deployments, because 25 % of three replicas rounds to one surge pod and zero unavailable pods.

What is the difference between blue/green and canary deployments?

Blue/green switches all traffic at once from a complete old environment to a complete new one and switches back for a rollback; nobody sees the new version until the switch, and everybody sees it after. Canary sends a small share of real traffic to a few new pods first and grows that share step by step while metrics are watched; a bad version reaches only the canary share. Blue/green needs double capacity for a while and no special router; canary needs weighted routing but only a couple of extra pods.

Which deployment strategies does Kubernetes support natively?

Only RollingUpdate and Recreate, the two values of the Deployment field spec.strategy.type. The ramped slow rollout is a RollingUpdate tuned with maxSurge 1, maxUnavailable 0 and minReadySeconds. Blue/green works with plain Kubernetes through two Deployments and a Service selector patch, but it is not a Deployment strategy. Canary, A/B testing and shadow need something that splits or mirrors traffic: Ingress NGINX, a Gateway API implementation, a service mesh such as Istio or Linkerd, or a progressive-delivery controller such as Argo Rollouts or Flagger.

How do I roll back a Kubernetes deployment?

For a Deployment, kubectl rollout undo deployment/my-app goes back to the previous ReplicaSet, or --to-revision=N to an older one listed by kubectl rollout history. The rollback is another rollout with the same strategy, so a Recreate Deployment has a second outage. Blue/green rolls back by patching the Service selector to the old colour, canary by setting the weight to 0 (Argo Rollouts: kubectl argo rollouts abort). Shadow needs no rollback because users never reached v2.

Is the animation a real Kubernetes trace?

No, it is a model. The rolling-update simulation follows the controller’s rules for maxSurge and maxUnavailable and shows the same scale-up and scale-down batches you would see in kubectl get pods -w, but real timing depends on image pulls, probes, minReadySeconds and the router. Use it to understand the shape of each strategy, then try the manifest in a test cluster.

Related vDan tools for Kubernetes

A strategy ends up as a few fields in a manifest and a few commands. These tools show both.

Sources