0
0
Kubernetesdevops~3 mins

Why Recreate update strategy in Kubernetes? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your app update could avoid confusing visitors with errors or mixed versions?

The Scenario

Imagine you have a website running on a server, and you want to update it to a new version. You stop the old version, then start the new one. During this time, visitors see errors or nothing at all.

The Problem

Manually stopping and starting services causes downtime. Visitors get frustrated because the site is unavailable. It's hard to coordinate updates without breaking the service.

The Solution

The Recreate update strategy in Kubernetes stops all old versions of your app before starting new ones. This ensures only one version runs at a time, avoiding conflicts and making updates predictable.

Before vs After
Before
ssh server
stop old app
start new app
After
kubectl patch deployment myapp -p '{"spec":{"strategy":{"type":"Recreate"}}}'
What It Enables

You can update your app safely with controlled downtime, avoiding mixed versions running together.

Real Life Example

A company updates a payment system where running two versions simultaneously could cause errors. Using Recreate strategy, they ensure the old version stops before the new one starts, keeping transactions safe.

Key Takeaways

Manual updates cause downtime and errors.

Recreate strategy stops old pods before starting new ones.

This makes updates predictable and safe for apps that can't run multiple versions at once.