Skip to main content
In this lesson you’ll deploy a simple multi-replica app and observe how Kubernetes handles updates using the two Deployment strategies: RollingUpdate (the default) and Recreate. You’ll see how each strategy affects application availability during a rollout.
The image shows a web interface of a Git repository named "cgoa-demos," displaying folders and files along with their last updated information. It is powered by Gitea and shows sections like commits, branches, and languages used.
Prerequisites
  • A working Kubernetes cluster and kubectl configured to talk to it.
  • curl available locally to probe the service.
  • The example repo is hosted at http://localhost:5000/kk-org/cgoa-demos (adjust to your environment).
Repository and manifests We will work from the patterns/release directory in the cgoa-demos repository. It contains two manifests: deployment.yml and service.yml. The Deployment shown below does not explicitly set a strategy, so Kubernetes will default to RollingUpdate.
If a Deployment does not specify strategy.type, Kubernetes uses RollingUpdate by default.
Initial Deployment manifest (as present in the repo)
Step-by-step: reproduce locally
  1. Clone the repository and open the release pattern directory
  1. Create a namespace and apply the manifests
Verify resources:
You should see the Deployment with 5 replicas and a Service of type NodePort. Note the NodePort value from the kubectl get svc output — you’ll use it to probe the app.
  1. Continuously probe the application to observe availability during rollouts
The application exposes /app which returns Application Version: vX. Use the loop below to poll the service every second and colorize responses so version switches and downtime are obvious. Replace 32431 with the actual NodePort reported for the Service.
  1. Perform a RollingUpdate (default behavior)
Trigger a RollingUpdate by changing the Deployment image to v2. This will roll new pods in while terminating old pods according to maxSurge / maxUnavailable settings (defaults preserve availability).
Expected observation
  • The polling loop should show a smooth transition from v1 to v2.
  • You might see, at most, a brief single-second miss while pods start, but generally there is no sustained downtime.
Example excerpt from the probe output:
This is how RollingUpdate preserves availability: new pods are started before old ones are terminated (subject to maxUnavailable / maxSurge).
  1. Switch the Deployment strategy to Recreate and observe the difference
Edit the Deployment to change the strategy to Recreate:
In the editor, add or update the strategy section:
If any rollingUpdate fields (e.g. maxSurge, maxUnavailable) exist, remove them for clarity when using Recreate. Then trigger another rollout (for example, set the image back to v1):
With Recreate, Kubernetes first terminates all existing pods and then starts new pods. Expect downtime between termination and readiness of the new pods — the Service will be unreachable during that window.
Expected observation under Recreate
  • The probe loop will show repeated ERROR: Service unreachable lines while Kubernetes brings up the new pods.
  • Once the new pods are ready, the probe resumes showing Application Version: v1 (or whatever target version you deployed).
Example observation sequence:
Quick comparison Further reading and references That’s all for this lesson — you can repeat the experiment with different replica counts, readiness probes, and maxSurge / maxUnavailable values to explore more nuanced availability behavior.

Watch Video