RollingUpdate (the default) and Recreate. You’ll see how each strategy affects application availability during a rollout.

- A working Kubernetes cluster and
kubectlconfigured to talk to it. curlavailable locally to probe the service.- The example repo is hosted at
http://localhost:5000/kk-org/cgoa-demos(adjust to your environment).
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.- Clone the repository and open the release pattern directory
- Create a namespace and apply the manifests
Service of type NodePort. Note the NodePort value from the kubectl get svc output — you’ll use it to probe the app.
- Continuously probe the application to observe availability during rollouts
/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.
- Perform a RollingUpdate (default behavior)
v2. This will roll new pods in while terminating old pods according to maxSurge / maxUnavailable settings (defaults preserve availability).
- The polling loop should show a smooth transition from
v1tov2. - You might see, at most, a brief single-second miss while pods start, but generally there is no sustained downtime.
maxUnavailable / maxSurge).
- Switch the Deployment strategy to Recreate and observe the difference
Recreate:
strategy section:
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.- The probe loop will show repeated
ERROR: Service unreachablelines 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).
| Strategy | Behavior during rollout | Typical downtime |
|---|---|---|
RollingUpdate (default) | Starts new pods before terminating old ones; traffic shifts gradually. | Minimal or none (depends on readiness probes and surge/unavailable settings) |
Recreate | Terminates all old pods first, then starts new pods. | Service unavailable during the interval between termination and readiness of new pods |
- Kubernetes Deployments: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
- Deployment strategy docs: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
maxSurge / maxUnavailable values to explore more nuanced availability behavior.