Recreate
Stop everything, then start the new version.
The simplest strategy there is. Every old instance is shut down, and only then are new ones started. Nothing serves traffic in between, so you get guaranteed downtime. In return you never have two versions running at once.
0.0s / 9s
Step 1 of 4: Steady state. Four v1 pods sit behind the Service and share all traffic.
- Availability
- 100%
- No downtime
- Pods running
- 1.00×
- Peak 1.00× of normal
- Blast radius
- —
- Inject a bug to measure
- Time to recover
- —
- No incident
v1 (current)v2 (new)StartingSucceededFailed
Trade-offs
More filled is better for you- Uptime during deploy
- 0 out of 4.Down until new pods are ready
- Low infra cost
- 4 out of 4.No extra capacity
- Rollback speed
- 1 out of 4.Another full redeploy and outage
- Small blast radius
- 0 out of 4.100% of users, at once
- Simplicity
- 4 out of 4.One line of config
- One version at a time
- 4 out of 4.Never two versions live
Pros and cons
Pros
- Trivial to reason about. There is exactly one version live at any moment.
- No extra capacity needed. You never pay for more pods than you run normally.
- Breaking schema or protocol changes are safe, because old and new code never overlap.
Cons
- Guaranteed downtime: shutdown, plus boot, plus readiness probe time.
- Every user is exposed to a bad release at the same moment.
- Rolling back means a second outage.
When to reach for it
Use it when
- Dev, staging, or internal tools where a short outage costs nothing.
- The app can't run two versions at once: singletons, exclusive locks, a database migration that isn't backwards compatible.
- Batch workers or consumers that can pause and resume safely.
Avoid it when
- Anything user-facing with an availability target.
- Slow-starting apps. The downtime grows with every second of boot time.
How to do it
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop
spec:
replicas: 4
strategy:
type: Recreate # kill all old pods, then create new ones
selector:
matchLabels: { app: shop }
template:
metadata:
labels: { app: shop }
spec:
containers:
- name: shop
image: registry.example.com/shop:2.0.0
readinessProbe:
httpGet: { path: /healthz, port: 8080 }Gotchas
- Downtime is not just container start. It includes image pull, app warm-up and the readiness probe's initialDelaySeconds.
- Pods with a long terminationGracePeriodSeconds hold up the start of the new version too.
- A bad image or a crash loop leaves you with zero running pods until you notice.