k for kubectl throughout (already configured in the environment). Key topics covered: inspecting Deployments, update strategies (RollingUpdate vs Recreate), updating images with kubectl set image, and observing behavior while traffic is served.
Make sure
k is aliased to kubectl in your environment. This guide uses k for brevity.v1 with a blue theme:

curl-test.sh script. While the app is serving v1 you will see output like:
frontend Deployment to see the image and update strategy:
- Container image:
kodekloud/webapp-color:v1 - Update strategy:
RollingUpdatewith25% maxUnavailableand25% maxSurge - With 4 replicas and
maxUnavailable: 25%, at most 1 pod (25% of 4) may be taken down at a time during a rolling update.
Perform a rolling update to v2
Update the Deployment’s image (this updates the pod template and triggers a rolling update):
RollingUpdate policy:
curl-test.sh to observe live traffic handling. You will typically see interleaved responses from v1 and v2 (blue and green):
Switching the Deployment strategy to Recreate
If you change the Deploymentspec.strategy.type from RollingUpdate to Recreate, Kubernetes will terminate all existing pods before creating new ones. Edit the Deployment (for example, kubectl edit deployment frontend) and set type: Recreate. Example fragment:
Recreate:
Perform a recreate-style update to v3
Now update the image to v3. With Recreate, Kubernetes will terminate all older pods first and then create the new set:
v3 (red):
Recreate can cause downtime: all old pods are terminated before new pods are available. Avoid using
Recreate if you require zero-downtime deployments, unless you have downstream buffering/load-balancing that can handle the outage.Comparison: RollingUpdate vs Recreate
Useful commands reference
Summary
- RollingUpdate upgrades pods a few at a time, following
maxUnavailableandmaxSurge, to minimize downtime. - With 4 replicas and
maxUnavailable: 25%, only 1 pod can be unavailable at a time during a rolling update. - Recreate terminates all old pods before creating new ones and can cause a service outage during the update.
- Use
kubectl set imageto change a Deployment’s image andkubectl describe deploy <name>to inspect the current strategy and pod template.