Skip to main content
In this hands-on demo you’ll see the practical difference between the RollingUpdate and Recreate deployment strategies in Kubernetes. We’ll deploy a small HTTP app that returns its version (v1 or v2) and observe behavior during an upgrade. This shows how each strategy affects availability and rollout behavior. What you’ll learn:
  • How to deploy a simple Deployment and Service
  • How RollingUpdate preserves availability during updates
  • How Recreate causes downtime by terminating all pods before creating new ones
Deployment manifest (patterns/release/deployment.yaml)
Note: The manifest above omits a strategy section. Kubernetes defaults to the RollingUpdate strategy when strategy is not specified.
If you require zero-downtime updates, RollingUpdate is the default and preferred choice. The Recreate strategy will terminate all existing pods before creating new ones, which causes an interruption in service.

1) Clone the repo and apply resources

Run the commands below to prepare the demo namespace and apply the manifests:
Verify the resources were created:
Example output:
The app exposes a simple endpoint (/app) that returns the version string:
A web browser window displaying a centered banner that reads "Application Version: v1" in large blue text inside a rounded, blue-outlined box on a light blue gradient background. The address bar shows a localhost URL.

2) Poll the endpoint continuously to observe updates

Use the following shell loop to poll the NodePort and colorize v1 / v2 responses. Replace the NodePort (32431) if yours differs.
Leave the loop running in a terminal. This will make the effect of each update immediately visible.

3) Rolling update (no downtime)

Because RollingUpdate is the default strategy, updating the Deployment image will perform a rolling upgrade: new pods are created and traffic shifts gradually from old pods to new pods. Update the image to v2 using kubectl set image:
kubectl will respond:
Sample polling output (shows continuous responses transitioning from v1 to v2 without downtime):
Explanation: RollingUpdate creates new pods running v2 while terminating old v1 pods in a controlled manner, maintaining service availability during the rollout.

4) Recreate strategy (introduce downtime)

To demonstrate downtime, change the Deployment strategy to Recreate. Edit the deployment:
Add or modify the strategy section in the spec:
Save the edit. Confirm the deployment now uses Recreate:
You should see:
Now update the image again (flip it back to v1 to see downtime):
kubectl will report:
Behavior: With Recreate, Kubernetes terminates all existing pods immediately and only then creates the new pods. During the gap between pod termination and the new pods becoming Ready, the Service has no ready endpoints and will return timeouts or errors. Example polling output showing downtime:
Using the Recreate strategy will cause downtime because all old pods are terminated before new pods are created. Use Recreate only when you must avoid running multiple versions concurrently and can tolerate interruptions.

Comparison: RollingUpdate vs Recreate

References

Summary
  • RollingUpdate (default): incrementally updates pods and preserves availability.
  • Recreate: shuts down all existing pods first, then starts new ones — which causes downtime.
This concludes the demo showing the practical differences between RollingUpdate and Recreate strategies for Kubernetes Deployments.

Watch Video

Practice Lab