Deployment Strategies in Kubernetes: RollingUpdate and Recreate

Deployment Strategies in Kubernetes: RollingUpdate and Recreate

Learn how Kubernetes replaces old versions of your application with new ones, how the two built-in strategies behave under the hood, and how to pick the right one for your workload without causing downtime or surprises.

Imagine a busy restaurant that wants to change its entire menu. The owner can close the doors for a whole afternoon, throw out the old menu, print the new one, and reopen. Or the owner can swap the menus table by table while the restaurant stays open, making sure every table always has someone to serve it. Both approaches get you a new menu, but they feel completely different to the guests. Kubernetes gives you exactly these two choices when you release a new version of an application, and understanding them is one of the most practical skills for anyone running software on a cluster.

1Why Deployment Strategies Matter

Shipping code is easy; shipping code without hurting users is the real craft.

Every application changes over time. Developers fix bugs, add features, patch security holes, and upgrade libraries. Each change eventually needs to reach the servers where real users are connecting. The moment a new version replaces an old one is called a release or a rollout, and it is one of the riskiest moments in the life of any system.

A deployment strategy is simply the plan for how the old version is swapped for the new one. The plan answers questions such as: do we stop everything first or replace gradually? How many copies can be missing at the same time? How do we know the new copy is healthy? What happens if it is not? Without a clear plan, releases become stressful events that people schedule for midnight and dread.

Simple Analogy

Think of changing the tyres on a bus. You could park the bus in the garage, change all four tyres, and drive it out again, meaning the passengers wait. Or you could do a pit-stop style change while the route is covered by other buses. The first is safe and simple but the route is empty for a while. The second keeps the route alive but needs spare buses and careful coordination.

What Kubernetes gives you out of the box

Kubernetes has a built-in object called a Deployment that manages the lifecycle of stateless application copies. Inside a Deployment there is a setting called the strategy, and it accepts exactly two types: RollingUpdate and Recreate. If you do not choose, Kubernetes picks RollingUpdate for you. Other popular approaches such as blue-green and canary releases are built on top of Kubernetes using extra objects or tools, and we will touch on them later in this guide.

2
Built-in strategy types
25%
Default surge and unavailable limit
10
Old revisions kept by default
i
Good to know

This guide assumes you have seen Kubernetes before, but every new term is explained the first time it appears. If a word feels unfamiliar, keep reading; it will be defined within a paragraph or two.

2The Building Blocks You Need First

Four objects work together every time a rollout happens.

Before comparing strategies, it helps to be clear about the objects involved. A rollout is not magic; it is a conversation between a small number of Kubernetes components, each with a narrow job. Once you know who does what, the behaviour of both strategies becomes easy to predict.

Term 1

Pod

The smallest runnable unit in Kubernetes. A pod wraps one or more containers that share networking and storage. Pods are disposable: when one dies it is not repaired, it is replaced.

Term 2

ReplicaSet

A controller whose only job is to keep a fixed number of identical pods running. If you ask for five and one crashes, the ReplicaSet starts a new one.

Term 3

Deployment

A higher-level controller that owns ReplicaSets. It adds versioning, rollouts, and rollbacks on top of the simple copy-keeping behaviour.

Term 4

Service

A stable network address that sends traffic to whichever pods are currently ready. Users talk to the Service, never directly to a pod.

Term 5

Controller

A loop that constantly compares the desired state you declared with the actual state of the cluster and takes action to close any gap.

Simple Analogy

A Deployment is like a store manager, a ReplicaSet is like a shift supervisor, and pods are the individual cashiers. The manager decides which staffing plan is current. The supervisor makes sure the right number of cashiers are at their tills. When the manager announces a new plan, a new supervisor is appointed for the new cashiers while the old supervisor gradually sends the old cashiers home.

Why the Service matters for rollouts

A Service keeps a list of pod addresses that are ready to receive traffic. When a pod becomes ready it is added to the list, and when it is terminating or unhealthy it is removed. This list is what makes zero-downtime rollouts possible, because the Service quietly shifts traffic away from old pods and toward new ones. If your Service or its health checks are misconfigured, no strategy can save you from dropped requests.

3How a Deployment Works Internally

The Deployment never touches pods directly; it manages ReplicaSets, and ReplicaSets manage pods.

When you create a Deployment, it creates one ReplicaSet, and that ReplicaSet creates the pods. The pods carry a special label containing a hash of the pod template, so each ReplicaSet can recognise which pods belong to it. This hash is the fingerprint of a version. Two pods with different fingerprints are considered different versions, even if they look almost the same.

What counts as a new version

Only changes to the pod template trigger a rollout. The pod template includes the container image, environment variables, resource requests, probes, volumes, and labels on the pod. Changing the number of replicas does not create a new version; it simply scales the current ReplicaSet up or down. This distinction surprises many beginners who expect any edit to cause a restart.

flowchart TD
    D[Deployment
desired state and strategy] --> RS1[Old ReplicaSet
version 1 pods] D --> RS2[New ReplicaSet
version 2 pods] RS1 --> P1[Pod v1] RS1 --> P2[Pod v1] RS2 --> P3[Pod v2] RS2 --> P4[Pod v2] S[Service] -.routes to ready pods.-> P1 S -.-> P3
FIG 1 — A Deployment owns one ReplicaSet per version, and the Service routes to ready pods from either

The diagram shows the heart of every rollout. During an update, the Deployment holds two ReplicaSets at the same time: the old one that is shrinking and the new one that is growing. The strategy decides how quickly and in what order these two counts change. After a successful rollout, the old ReplicaSet remains with zero pods, kept as a history record so that a rollback is quick.

The reconciliation loop

The Deployment controller runs a continuous loop. It observes the current number of pods in each ReplicaSet, compares them to the numbers allowed by the strategy, and adjusts the replica counts of the ReplicaSets. It does not command pods to start or stop. It only edits numbers on ReplicaSets, and the ReplicaSet controllers do the actual creating and deleting. This layered design keeps each component simple and makes the whole system resilient to restarts of any single controller.

i
Key insight

A rollout is really just two numbers changing over time: the new ReplicaSet count goes up and the old ReplicaSet count goes down. RollingUpdate changes them together in small steps. Recreate sets the old to zero first and then raises the new.

4The Recreate Strategy

Stop everything, then start everything: the simplest possible release.

With the Recreate strategy, Kubernetes first scales the old ReplicaSet down to zero pods. It waits until those pods are fully gone. Only then does it scale the new ReplicaSet up to the desired number. At no point do the old and new versions run at the same time.

Simple Analogy

Recreate is the restaurant closing for the afternoon to swap every menu. Nobody is served during the swap, but nobody can ever receive a half-old, half-new experience either. When the doors open again, everything is consistent.

What you gain

The greatest gift of Recreate is certainty. Since only one version runs at any moment, you never have to worry about two versions disagreeing about data formats, message shapes, or database structure. You also never need spare cluster capacity for extra pods, because the old ones disappear before the new ones appear. Some workloads simply cannot tolerate two copies running at once, and for them Recreate is the natural fit.

What you pay

The price is downtime. Between the moment the last old pod stops and the moment the first new pod becomes ready, no pod is available to answer requests. That gap includes image pulling, container startup, application warm-up, and the time for readiness checks to pass. For a lightweight service it may be seconds; for a heavy application with caches to load, it may be minutes.

Advantages

  • Only one version is ever running, so no version-mixing problems
  • No extra cluster capacity is needed during the release
  • Simple to reason about and easy to debug
  • Safe for applications that hold exclusive locks or single-writer volumes
  • Clean database migrations without backward-compatibility gymnastics

Disadvantages / Trade-offs

  • Guaranteed downtime for the duration of the swap
  • Rollback also causes downtime, since it is another Recreate
  • A broken new version means a full outage until you fix it
  • Unsuitable for user-facing services with availability targets
!
Common Misconception

Many people think Recreate deletes the Deployment and builds a new one. It does not. The Deployment object stays in place; only the pods are removed and recreated through ReplicaSets. Revision history and rollback still work exactly as before.

5Recreate: Lifecycle and Data Flow

Follow a single Recreate rollout from the moment you change the image to the moment traffic returns.

sequenceDiagram
    participant U as User
    participant DC as Deployment Controller
    participant OLD as Old ReplicaSet
    participant NEW as New ReplicaSet
    participant SVC as Service
    U->>DC: Update pod template
    DC->>OLD: Scale to 0
    OLD-->>SVC: Pods leave endpoint list
    Note over SVC: Downtime window begins
    OLD-->>DC: All old pods terminated
    DC->>NEW: Scale to desired count
    NEW-->>SVC: Pods pass readiness, join endpoints
    Note over SVC: Downtime window ends
        
FIG 2 — Recreate sequence: the downtime window lasts from the first pod leaving until the first new pod is ready
1

Template change detected

You update the image or another part of the pod template. The Deployment controller notices the new fingerprint and creates a fresh ReplicaSet for it, initially with zero pods.

2

Old pods are told to stop

The old ReplicaSet is scaled to zero. Each old pod is marked as terminating, removed from the Service endpoint list, and given time to shut down gracefully.

3

Wait for full termination

The controller does not proceed until the old pods are truly gone. This wait is what guarantees that the two versions never overlap, and it is also why the downtime window can be longer than you expect if shutdown is slow.

4

New pods start

The new ReplicaSet is scaled to the full desired count. All new pods are created at roughly the same time, which can cause a sudden burst of image pulls and scheduling activity.

5

Readiness gates the traffic

As each new pod passes its readiness check, it is added to the Service and begins receiving requests. The rollout is complete when all new pods are ready.

Where the downtime really comes from

Downtime in a Recreate rollout is the sum of several delays: the graceful shutdown period of old pods, the scheduling time for new pods, the image pull time if the image is not cached on the node, the container start time, the application start-up and warm-up, and the readiness probe delays. You can shrink some of these, for example by using smaller images and faster start-up, but you can never reduce the total to zero. That is the fundamental nature of the strategy.

6The RollingUpdate Strategy

Replace pods a few at a time so the application never fully disappears.

RollingUpdate is the default strategy and the one most teams use for everyday releases. Instead of stopping everything, Kubernetes gradually creates new pods and removes old ones in small batches. At every moment during the rollout, some old pods and some new pods are serving traffic together. When the last old pod is gone, the release is complete.

Simple Analogy

RollingUpdate is the restaurant that swaps menus one table at a time. A few tables have the new menu while the rest still have the old one. The waiters never stop working, and guests are hardly aware anything is changing. The downside is that for a short while two different menus are in circulation, and the staff must be ready for questions about both.

Two dials control the pace

RollingUpdate exposes two settings, maxSurge and maxUnavailable. Together they define how aggressive or cautious the rollout is. One dial says how many extra pods may exist above the desired count. The other says how many pods may be missing below the desired count. We look at them closely in the next chapter, because getting these two numbers right is the difference between a smooth release and a painful one.

graph LR
    A[Start
4 old pods] --> B[Create 1 new pod
4 old, 1 new] B --> C[New pod ready
remove 1 old
3 old, 1 new] C --> D[Create another new
3 old, 2 new] D --> E[Repeat until done] E --> F[Finish
4 new pods]
FIG 3 — A rolling update moves through mixed states, never dropping to zero available pods

Advantages

  • No planned downtime when probes and shutdown are configured well
  • Problems in the new version are noticed early, before all pods are replaced
  • Rollout speed is tunable with two simple settings
  • Rollback is itself a rolling update, so it is also gentle
  • Works well with autoscaling and normal cluster capacity

Disadvantages / Trade-offs

  • Two versions run side by side, so compatibility must be designed in
  • Needs some spare capacity for surge pods
  • Slower than Recreate for large deployments
  • Weak health checks can let a broken version spread

7maxSurge and maxUnavailable in Depth

Two small numbers that decide speed, safety, and cost.

Setting 1

maxSurge

The maximum number of pods that may exist above the desired replica count during the rollout. It can be an absolute number or a percentage. Percentages are rounded up.

Setting 2

maxUnavailable

The maximum number of pods that may be unavailable below the desired count during the rollout. It can be an absolute number or a percentage. Percentages are rounded down.

The defaults for both are twenty-five percent. For a Deployment with ten replicas, that means up to three extra pods may be created (two and a half rounded up) and up to two pods may be unavailable (two and a half rounded down). The controller keeps the total number of pods within the upper limit and the number of ready pods above the lower limit throughout the rollout.

Simple Analogy

Imagine a relay race where runners are being swapped. maxSurge is how many extra runners are allowed on the track at the same time. maxUnavailable is how many lanes are allowed to be empty. If you allow no empty lanes, you must bring in extra runners before anyone leaves. If you allow no extra runners, someone must leave before a replacement arrives.

Common combinations and what they mean

Setting CombinationBehaviourCapacity ImpactBest For
maxSurge 1, maxUnavailable 0Add one new pod, wait until ready, then remove one old podFull capacity always kept, needs one spare slotCritical services that cannot lose capacity
maxSurge 0, maxUnavailable 1Remove one old pod first, then add one new podCapacity drops by one during each step, no extra room neededTight clusters with no spare resources
maxSurge 25%, maxUnavailable 25%Default: moderate speed, small dip and small extraSome dip and some extra at the same timeGeneral purpose workloads
maxSurge 100%, maxUnavailable 0Create a full second set, then remove the old setDouble capacity needed brieflyFast, safe releases when resources are plentiful
maxSurge 0, maxUnavailable 100%Behaves much like RecreateAll pods can go away togetherRarely a good idea; choose Recreate honestly instead
!
Important Rule

maxSurge and maxUnavailable cannot both be zero. If both were zero, Kubernetes could never add a pod and could never remove a pod, so the rollout could never move. The API rejects this combination.

Choosing values with real numbers

Consider a Deployment with eight replicas, each using half a CPU core. With maxSurge of two, the cluster must be able to host ten pods at the peak, so five CPU cores rather than four. If your cluster has no spare room, the surge pods will sit in a pending state, and the rollout will stall waiting for capacity. Always check that the surge fits before you rely on a high value.

On the other side, with maxUnavailable of two, your service temporarily runs on six of eight pods. If your normal traffic already uses seventy-five percent of capacity, the remaining pods will run very hot during the release. The safest choice for user-facing services is usually maxUnavailable of zero with a small surge, accepting that the rollout takes longer.

Up
maxSurge rounds percentages up
Down
maxUnavailable rounds percentages down
0 + 0
Never allowed together

8Health Probes: The Gatekeepers of a Rollout

A rolling update is only as safe as the checks that decide a pod is ready.

How does Kubernetes know a new pod is healthy enough to replace an old one? It relies entirely on the probes you define. Without a readiness probe, a pod is considered ready the instant its container starts, even if the application inside is still loading. The rollout then races ahead, removes old pods, and sends users to pods that cannot answer yet.

Probe 1

Readiness probe

Answers the question: can this pod receive traffic right now? A failing readiness probe removes the pod from the Service and stalls the rollout. This is the most important probe for deployments.

Probe 2

Liveness probe

Answers the question: is this container stuck and in need of a restart? A failing liveness probe causes the container to be restarted. It does not decide traffic routing.

Probe 3

Startup probe

Gives slow-starting applications extra time before the other probes begin. It prevents a heavy application from being killed while it is still booting.

Setting

minReadySeconds

The number of seconds a pod must stay ready, without crashing, before it counts as available. It adds a safety pause that catches pods that pass the first check and then fail.

Simple Analogy

A new cashier arriving at a store should not be put on a till because they walked through the door. They should first log in, count their float, and confirm the machine works. The readiness probe is that check. minReadySeconds is the manager watching for a few minutes to see that the cashier really is coping before sending the old cashier home.

Designing a good readiness check

A useful readiness check confirms that the application can actually do its job. It should verify that the process is listening, that essential dependencies such as the database connection are reachable, and that any required caches are loaded. However, it should not depend on every downstream service in the company, because a distant outage would then make all your pods unready and turn a small problem into a total one.

i
Practical Tip

Treat readiness as a promise to the Service: “send me traffic, I can handle it.” Treat liveness as a last resort: “restart me, I am stuck.” Mixing the two up is one of the most common causes of restart storms during releases.

How probes affect both strategies

In a RollingUpdate, readiness decides when the controller may proceed to the next batch. A pod that never becomes ready freezes the rollout, which is exactly what you want because the old pods keep serving users. In a Recreate rollout, readiness decides when the downtime ends. A slow readiness check directly lengthens the outage, so tuning its initial delay and period carefully has real user impact.

9Graceful Termination and Connection Draining

Removing an old pod politely is as important as starting a new one.

When a pod is told to stop, Kubernetes does not simply pull the plug. It follows a sequence: the pod is marked as terminating, it is removed from the list of Service endpoints, a pre-stop hook runs if one is defined, the container receives a termination signal, and after a grace period the container is forcibly killed if it is still running. The default grace period is thirty seconds.

sequenceDiagram
    participant C as Controller
    participant P as Old Pod
    participant E as Endpoint Update
    participant L as Load Balancers and Proxies
    C->>P: Mark terminating
    par In parallel
        C->>E: Remove pod from endpoints
        E->>L: Propagate new list
    and
        P->>P: Run pre-stop hook
    end
    P->>P: Receive termination signal
    P->>P: Finish in-flight requests
    Note over P: Grace period countdown
    P-->>C: Exit cleanly or be force-killed
        
FIG 4 — Termination steps: endpoint removal and shutdown begin at the same time, which creates a small race

The hidden race condition

Endpoint removal and the shutdown signal happen in parallel, not one after the other. Load balancers, ingress controllers, and node proxies need a moment to learn that the pod is gone. During that moment, new requests may still be sent to a pod that has already started shutting down. If the application exits instantly on the signal, those requests fail with connection errors, and users see brief failures during an otherwise perfect rolling update.

Simple Analogy

A shop assistant is told they are leaving at closing time. If they walk out the instant the announcement is made, customers who are already in the queue are abandoned. A polite assistant finishes serving the queue, and a good manager also changes the sign on the door so that no new customers line up.

Practices that make termination smooth

Use a short pre-stop delay

A pre-stop hook that simply waits for a few seconds gives the rest of the network time to stop sending traffic before the application begins shutting down. This small delay removes most connection errors during rollouts.

Handle the termination signal properly

The application should stop accepting new connections, finish in-flight requests, close database connections cleanly, and then exit. Many frameworks support this, but it is often not switched on by default.

Set the grace period to match reality

If your longest request takes forty seconds, a thirty-second grace period will cut it off. Set the grace period to comfortably exceed the longest request plus the pre-stop delay.

Make sure the signal reaches your app

If a container starts through a wrapper script, the termination signal may reach the script and never the application. Ensure the main process is the application itself, or that the wrapper forwards signals.

i
Why it matters for Recreate too

In a Recreate rollout, a long grace period directly extends the downtime window because the controller waits for old pods to disappear before starting new ones. Set it to the shortest safe value for such workloads.

10Progress, Rollback, and Revision History

Every rollout can be watched, paused, and reversed.

A Deployment reports its own status, and understanding those signals turns a release from a leap of faith into a supervised process. The Deployment tracks conditions such as Progressing, which says whether the rollout is moving forward, and Available, which says whether the minimum number of pods is serving. These conditions are what dashboards and pipelines read to decide if a release succeeded.

Setting 1

progressDeadlineSeconds

How long the controller waits for progress before marking the rollout as failed. The default is ten minutes. It does not roll back automatically; it only reports the failure.

Setting 2

revisionHistoryLimit

How many old ReplicaSets are kept for rollback. The default is ten. Setting it to zero removes the ability to roll back.

Action 1

Pause and resume

A rollout can be paused midway so you can inspect the mixed state, and resumed when satisfied. While paused, further template edits are batched into one later rollout.

Action 2

Rollback

Returning to a previous revision simply scales the old ReplicaSet back up using the same strategy. Under RollingUpdate this is gentle; under Recreate it causes another outage.

!
Common Mistake

A failed progress deadline does not undo anything. The half-finished rollout stays exactly where it is, with some old pods and some new pods running. Someone or something must decide to roll back or fix forward. Many teams assume Kubernetes reverts automatically and are surprised to find a stuck mixed state hours later.

1

Watch the rollout

Follow the rollout status until it reports completion, or until the progress deadline passes. Pipelines should wait on this signal instead of assuming success.

2

Diagnose if it stalls

Check pod events for image pull errors, scheduling failures, failing probes, or crash loops. Most stalls have a plain, visible cause.

3

Decide: fix forward or roll back

If the fix is small and known, push a corrected version. If not, roll back to the last good revision and investigate calmly.

4

Confirm recovery

Verify that the available pod count and user-facing metrics have returned to normal before closing the incident.

11RollingUpdate vs Recreate: Side by Side

A direct comparison of the two strategies across the qualities that matter in production.

AspectRollingUpdateRecreate
DowntimeNone planned, if probes and shutdown are configured wellGuaranteed for the whole swap
Versions running togetherYes, old and new overlapNever
Extra capacity neededYes, for surge pods, unless surge is zeroNo
Rollout speedGradual, tunableFast in structure, but includes an outage
Blast radius of a bad releaseLimited, since the rollout stalls earlyTotal, since all pods are replaced together
Rollback behaviourAnother gentle rolling updateAnother outage
Database compatibility demandsHigh, both versions must work with the same dataLow, one version at a time
Exclusive volumes or locksCan conflict during overlapWorks naturally
ComplexityModerate, many settings to tuneVery low
Typical fitWeb services, APIs, microservicesBatch consumers, single-writer apps, dev environments
flowchart TD
    Q1{Can two versions
run together safely?} -->|No| R[Use Recreate] Q1 -->|Yes| Q2{Is downtime
acceptable?} Q2 -->|Yes and simplicity wanted| R Q2 -->|No| Q3{Is spare capacity
available?} Q3 -->|Yes| RU1[RollingUpdate
surge above zero, unavailable zero] Q3 -->|No| RU2[RollingUpdate
surge zero, unavailable small]
FIG 5 — A simple decision path for choosing a strategy
“Choose Recreate when two versions cannot coexist, and RollingUpdate when users cannot wait.”

12When to Use Each Strategy

Real workloads and the strategy that fits them.

Situations that favour RollingUpdate

Customer-facing web applications and APIs

Users expect the site to be there at all hours. Rolling updates let you release many times a day without a maintenance window, which is why they are the default for most stateless services.

Microservices behind a service mesh or gateway

Dozens of small services are updated independently, and none may cause an outage for the others. Gradual replacement keeps each service continuously reachable.

Services with strict availability targets

When a service promises high uptime, even a one-minute outage per release may exceed the yearly budget. Rolling updates with zero unavailability protect that budget.

Situations that favour Recreate

Applications using an exclusive single-attach volume

Some storage can be attached to only one node at a time. A rolling update may try to start the new pod on another node while the old pod still holds the volume, leaving the new pod stuck. Recreate frees the volume first.

Workloads that must never run twice

A background scheduler, a singleton leader that owns a job queue, or an application that takes an exclusive lock on shared data cannot safely overlap with a second copy. Recreate guarantees a clean handover.

Releases with incompatible data changes

If the new version changes a data format in a way the old version cannot read, and you cannot spread the change over several releases, a short planned outage with Recreate is safer than corrupted data.

Development and test environments

In an environment with no real users, the simplicity, lower resource use, and predictable state of Recreate are welcome, and downtime costs nothing.

i
Middle Path

If you are tempted by Recreate only because of a single-attach volume, consider whether the application really needs that volume. Moving state to a managed database or object store often lets the service become stateless and eligible for rolling updates.

13Version Compatibility and Data Changes

The hardest part of a rolling update is not Kubernetes; it is your own software.

During a rolling update, old and new pods serve requests at the same moment, and both talk to the same database, cache, and message queues. A user might load a page from a new pod and then submit a form that lands on an old pod. If the two versions disagree about anything shared, users will see errors that are hard to reproduce and seem to vanish minutes later.

Simple Analogy

Imagine a library that is moving to a new catalogue system while staying open. Some librarians use the old card index and some use the new computer. If the new system renames a shelf but the old librarians still look for the old name, visitors get sent to the wrong place. The move only works if both systems can find the same books during the transition.

The expand and contract approach

The safest pattern for changing shared data is to do it in stages, each of which is compatible with the version before and after. First, expand: add new columns, tables, or message fields in a way that the old version simply ignores. Second, release the new version, which begins to use the new structure while still tolerating the old. Third, once the old version is completely gone, contract: remove the unused old structure in a later release.

1

Expand the data structure

Add the new elements without removing or renaming anything. Old pods keep working because nothing they rely on has changed.

2

Roll out the new application version

The new version writes to both old and new structures or reads from whichever is available. During the overlap, both versions coexist happily.

3

Migrate remaining data

Once all pods run the new version, move any leftover old-format data over in the background.

4

Contract in a later release

Remove the old structure only after confidence is high that a rollback to the old version will no longer be needed.

!
Rollback Trap

If a release drops or renames data and then you roll back, the old code will run against a structure it no longer understands. Keeping changes additive is what makes rollback a safe escape hatch rather than a second incident.

Other shared surfaces to check

Data is not the only shared surface. Consider the format of messages placed on queues, keys and values stored in caches, the shape of API responses that other services depend on, the names of cookies and session data, and static files served by a content network. Each of these can be seen by both versions at once and must remain compatible across the overlap.

14Capacity, Autoscaling, and Disruption Budgets

A rollout shares the cluster with everything else that is going on.

Capacity planning

RollingUpdate with a surge needs room for extra pods. If the cluster is full, surge pods stay pending and the rollout stalls without any error in the application itself. A helpful habit is to keep some headroom in the cluster, or to set the surge to zero and accept a small controlled dip in capacity for workloads that have no room to spare. Resource requests on pods should also be realistic, since inflated requests waste headroom and understated ones cause noisy neighbours.

Interaction with the Horizontal Pod Autoscaler

A Horizontal Pod Autoscaler adjusts the replica count of a Deployment based on load. During a rolling update, the autoscaler and the rollout both influence the number of pods, and this is supported by Kubernetes: the rollout proportionally distributes new replicas between old and new ReplicaSets. Still, it is wise to avoid releasing at peak traffic, because low available capacity combined with a load spike is a risky mix.

Pod Disruption Budgets

A Pod Disruption Budget states how many pods of an application may be voluntarily taken away at once, for example during node maintenance or cluster upgrades. It is an important safety net for those events. However, the pod replacement done by a Deployment rollout is governed by the strategy settings, maxSurge and maxUnavailable, and not by the budget. That means you should tune those two settings on purpose rather than relying on the budget to protect your rollouts.

Concern 1

Node drains during a rollout

If a node is drained while a rollout is in progress, both events remove pods. A budget limits the drain, and the strategy limits the rollout, but together they can still reduce capacity more than expected.

Concern 2

Resource quotas

Namespace quotas count surge pods too. A rollout can fail to create pods if the quota leaves no room for the temporary extra pods.

Concern 3

Spreading across zones

Topology spread rules keep pods balanced across zones. During a rollout, new pods should still respect them, otherwise a zone failure right after a release could take out a large share of capacity.

15Security Considerations During Releases

A rollout is a moment when new code, and sometimes new permissions, enter your cluster.

Security in deployment is about making sure that what runs is what you intended, and that the release process itself cannot be abused. Because every rollout pulls an image and starts it with certain permissions, the rollout path is a natural place for attackers to try to slip something in. A careful team treats the release pipeline as part of the attack surface.

Pin images to immutable references

Using a moving label such as a generic latest tag means two pods of the same Deployment may run different code. Immutable version identifiers or content digests guarantee that every pod of a version is byte-for-byte identical.

Scan and sign images

Scan images for known vulnerabilities before release and verify signatures at admission time, so that only trusted images are allowed to start, including during rollouts and rollbacks.

Limit who can change a Deployment

Role-based access control should restrict who can edit pod templates, pause rollouts, or roll back. Someone who can change a template can run arbitrary code inside your cluster.

Least privilege inside the pod

Run containers as a non-root user, drop unneeded capabilities, and use read-only file systems where possible. A rollout should never quietly widen the permissions of your workloads.

i
Security and rollback

Old revisions kept for rollback may contain images with known vulnerabilities. If a security fix is the reason for a release, remember that rolling back reintroduces the flaw, so plan a fix-forward path instead.

16Monitoring, Logging, and Metrics for Rollouts

You cannot manage what you cannot see.

A healthy release process treats the rollout as an event to be observed. Two kinds of signals matter: signals from Kubernetes about the rollout mechanics, and signals from your application about user experience. A rollout can be mechanically successful and still be bad for users, so you need both.

Signal 1

Replica counts

Watch desired, updated, ready, and available replicas. A widening gap between desired and available is the earliest sign of trouble.

Signal 2

Pod restarts and crash loops

A new version that keeps crashing will show rising restart counts long before the progress deadline expires.

Signal 3

Error rate and latency

The true test of a release. Compare error percentage and response time before, during, and after the rollout, ideally separated by version.

Signal 4

Events and conditions

Cluster events explain why pods are pending, why images failed to pull, or why probes fail. They are the first place to look when a rollout stalls.

Signal 5

Saturation

CPU and memory usage of the remaining pods during the release show whether capacity is stretched too thin.

Marking releases in your dashboards

Adding a version label to logs and metrics lets you separate the behaviour of old and new pods during the overlap. Marking each release on a dashboard timeline makes it easy to connect a change in error rate with a specific release. Many teams also configure alerts for stalled rollouts, so that a stuck release is noticed within minutes rather than discovered by a customer.

17Beyond the Two Built-in Strategies

Where blue-green, canary, and other update types fit into the picture.

RollingUpdate and Recreate are the only two strategy types a Deployment understands, but teams often need more control. More advanced release patterns are built on top of Kubernetes using extra objects, traffic routers, or dedicated tools. It helps to know what they are so you can recognise when the built-in options are no longer enough.

Pattern 1

Blue-green

Two complete environments run side by side. Traffic is switched all at once from the old one to the new one, usually by changing a Service selector or a router. Rollback is an instant switch back, at the cost of double resources.

Pattern 2

Canary

A small share of real traffic is sent to the new version first. If metrics look healthy, the share grows step by step. It needs a traffic-splitting layer such as a service mesh or an advanced ingress.

Pattern 3

Progressive delivery tools

Dedicated controllers automate canary and blue-green steps, watch metrics, and roll back automatically when thresholds are crossed.

Update strategies for other workload types

Deployments are not the only objects that roll out new versions. A StatefulSet, used for applications that need stable identity and storage, updates its pods one at a time in reverse order by default, and it offers a partition setting to stage updates. A DaemonSet, which runs one pod per node, has its own rolling update behaviour controlled by a maximum-unavailable setting. The idea is always the same: replace pods gradually, and only proceed when the previous step is healthy.

i
A useful mental model

Think of RollingUpdate as the foundation. Canary and blue-green add more control over who sees the new version and when, while the built-in rolling update still does the actual replacing of pods underneath.

Mistakes that turn a routine release into an incident.

ANTI-PATTERN-01 Avoid
Problem

Running a rolling update with no readiness probe defined.

Why It’s Harmful

Kubernetes treats every pod as ready the moment its container starts. The rollout races ahead, old pods disappear, and users are sent to pods still loading.

Correct Approach

Define a meaningful readiness check for every workload that receives traffic, and add a small minimum ready time to catch pods that fail shortly after starting.

ANTI-PATTERN-02 Avoid
Problem

Using a moving image tag such as latest in the pod template.

Why It’s Harmful

Pods created at different times may run different code, and a template that never changes will not trigger a rollout at all. Rollbacks become meaningless because the old label points to new content.

Correct Approach

Use unique, immutable version tags or digests so every change is visible, traceable, and reversible.

ANTI-PATTERN-03 Avoid
Problem

Choosing Recreate for a user-facing service simply because it is easier.

Why It’s Harmful

Every release causes an outage, so teams start avoiding releases, which makes each one larger and riskier.

Correct Approach

Use RollingUpdate for user-facing services, and reserve Recreate for workloads that truly cannot overlap.

ANTI-PATTERN-04 Avoid
Problem

Making destructive data changes in the same release as the code that needs them.

Why It’s Harmful

During the overlap, old pods break against the new structure, and a rollback cannot restore what was deleted.

Correct Approach

Apply additive changes first, release the code, and remove old structures only in a later release.

ANTI-PATTERN-05 Avoid
Problem

Ignoring graceful shutdown and relying on the default kill after the grace period.

Why It’s Harmful

In-flight requests are cut off and connections reset, producing small but real error spikes on every release.

Correct Approach

Handle the termination signal, add a short pre-stop delay, and match the grace period to your longest request.

19Best Practices and Common Mistakes

A checklist of habits that keep releases boring, which is the goal.

Best Practices

  • Default to RollingUpdate and justify any use of Recreate
  • Set maxUnavailable to zero for critical services and use a small surge
  • Define readiness probes that reflect true ability to serve
  • Add a pre-stop delay and handle termination signals
  • Keep a healthy revision history for quick rollback
  • Watch user-facing metrics, not just rollout status
  • Release outside peak traffic where possible

Common Mistakes

  • Assuming a failed rollout reverts automatically
  • Setting revision history to zero and losing rollback
  • Choosing a surge larger than the cluster can host
  • Using the same check for readiness and liveness
  • Forgetting that quotas count temporary surge pods
  • Ignoring version overlap in data and message formats
!
Watch Out

Changing only the replica count does not roll anything out, and changing a label on the pod template does. Small edits to a template that seem harmless, such as an added annotation, will restart every pod. Always review what part of the template you are touching.

20Real-World Scenarios

How the choice plays out in everyday engineering situations.

An online shop releasing during a sale

A retailer with dozens of replicas of its checkout service uses RollingUpdate with zero unavailable pods and a small surge. The rollout takes a few extra minutes, but the checkout never drops a single order. A stalled rollout is caught by an alert, and the team rolls back in moments because the previous version is still in the revision history.

A report generator with a shared volume

An internal reporting tool writes to an exclusive volume that can be attached to only one node. A rolling update would try to start the new pod while the old still holds the volume, so the team chooses Recreate and schedules releases in the early morning when nobody is generating reports.

A queue consumer that must be a singleton

A service that reads from a queue and writes to a shared ledger must never run in two copies, otherwise entries could be processed twice. With Recreate, the old copy is guaranteed to have stopped before the new copy begins.

A media platform with a slow-starting service

A streaming platform runs a recommendation service that needs several minutes to load models into memory. With a startup probe and a generous minimum ready time, rolling updates proceed safely, and old pods keep serving until the new ones have finished warming up.

A staging environment for developers

A team uses Recreate in its staging cluster to keep resource usage low and behaviour predictable. Production for the same application uses RollingUpdate, so the two environments differ on purpose, and the team documents this to avoid confusion when timing differs.

21Frequently Asked Questions

Q1What is the default deployment strategy in Kubernetes?

RollingUpdate is the default. If you do not specify a strategy, a Deployment uses RollingUpdate with a maximum surge of twenty-five percent and a maximum unavailable of twenty-five percent.

Q2Does a RollingUpdate always guarantee zero downtime?

No. It makes zero downtime possible, but only when readiness probes, graceful shutdown, capacity, and version compatibility are all handled properly. Weak probes or abrupt shutdowns can still cause errors.

Q3Does scaling a Deployment trigger a rollout?

No. Only changes to the pod template create a new revision. Scaling simply adjusts the number of pods in the current ReplicaSet.

Q4Why did my rollout get stuck?

The most common causes are pods that cannot be scheduled because the cluster is full, images that cannot be pulled, readiness probes that never pass, and quotas that block extra pods. Cluster events usually name the cause directly.

Q5Does Kubernetes roll back automatically when a rollout fails?

No. After the progress deadline passes, the Deployment is marked as failed, but nothing is reverted. You or your automation must roll back or fix forward.

Q6Can both maxSurge and maxUnavailable be zero?

No. With both at zero, the controller could neither add nor remove pods, so the rollout could not progress. The configuration is rejected.

Q7Is Recreate ever the right choice in production?

Yes. It suits workloads that must never overlap, use exclusive single-attach storage, or can tolerate a planned short outage. It is a deliberate tool, not a lazy default.

Q8How is a rollback performed under each strategy?

A rollback restores an earlier ReplicaSet using the same strategy that is configured. Under RollingUpdate it is gradual and safe; under Recreate it is another full stop and start.

Q9Do Pod Disruption Budgets control Deployment rollouts?

No. They protect against voluntary evictions such as node drains. Rollout pace is controlled by the strategy settings, so those must be tuned separately.

Q10What is the difference between a rolling update and a canary release?

A rolling update gradually replaces pods, and traffic spreads across them in proportion to their numbers. A canary release deliberately controls the exact share of traffic sent to the new version, usually with a traffic-splitting layer, and evaluates metrics before continuing.

Q11Why should I avoid the latest image tag?

Because it is a moving target. Different pods may run different code, template changes may go unnoticed, and rollbacks lose their meaning. Use unique version identifiers instead.

22Summary and Key Takeaways

A deployment strategy is the plan for replacing an old version of your application with a new one. Kubernetes offers two built-in choices. RollingUpdate replaces pods gradually, keeping the application available while old and new versions briefly coexist. Recreate stops every old pod first and then starts the new ones, trading a period of downtime for perfect separation between versions. Neither is better in every case; the right choice depends on whether your users can wait and whether your software can tolerate two versions running together.

The strategy is only part of the story. Health probes, graceful shutdown, capacity headroom, data compatibility, and careful monitoring are what turn a working configuration into a safe and boring release process. When these pieces are in place, teams can release many times a day with confidence, and rollback becomes a calm, practiced routine rather than an emergency.

Key Takeaways

  • RollingUpdate is the default — it replaces pods in small batches so the service stays available, and it is the right choice for most user-facing workloads.
  • Recreate trades downtime for simplicity — use it when two versions must never run together, when storage is exclusive, or when a planned outage is acceptable.
  • maxSurge and maxUnavailable set the pace — zero unavailable with a small surge is the safest pairing, and both can never be zero at once.
  • Readiness probes are the gatekeepers — without them, Kubernetes assumes pods are ready instantly and the rollout can outrun your application.
  • Graceful shutdown prevents hidden errors — handle termination signals, add a short pre-stop delay, and match the grace period to real request times.
  • Design for version overlap — use additive, staged data changes so old and new pods can share the same data, and so rollbacks remain safe.
  • Observe every release — watch replica counts, restarts, error rates, and latency, and remember that a failed rollout does not revert itself.