Problem statement
The storefront web tier runs six replicas in namespace storefront-release, and every release so far has been the same ritual: take the Deployment away, put it back with the new image, apologise for the gap. The Deployment is pinned to the strategy that does exactly that - all six pods stop, then all six start - so the outage is not an accident, it is the configuration. Ship the next build without it.
About this exercise
A Deployment does not run pods. It owns a ReplicaSet, and the ReplicaSet runs the pods. Change anything in the Deployment's pod template and the Deployment creates a new ReplicaSet for the new template and moves replicas from the old one to the new one. The old ReplicaSet is not deleted; it is scaled to zero and kept, which is what makes a release reversible.
How those replicas move is the strategy. Recreate scales the old ReplicaSet to zero first and only then scales the new one up - a guaranteed gap. RollingUpdate interleaves the two, and two numbers bound how far it may go at any moment:
- maxSurge - how many pods above the desired count may exist while the release runs. It buys headroom: new pods can start before old ones stop.
- maxUnavailable - how many of the desired pods may be unavailable at once. It is the floor under your capacity during the release.
Both accept a count or a percentage. Together they define the window the controller works inside: it will never let the total replicas exceed desired plus surge, and never let availability drop below desired minus unavailable. A replica only counts as available once it has been ready for minReadySeconds, so that dwell time is what stops a release from racing through a fleet of pods that crash a second after they start.
The release is not finished when the command returns - it is finished when the controller says so. kubectl rollout --help and kubectl explain deployment.spec.strategy are the reference.
How this project is graded
The grader reads the live Deployment and its ReplicaSets, and reads the samples you took while the release was running. A rollout is over in seconds and leaves no record of the counts it passed through, so those samples are the evidence: they must have been taken during the replacement, and every one of them must sit inside the window the strategy declares. The namespace is re-seeded before each run, so if you delete the Deployment the old build comes back.
What you will build
Everything lives in namespace storefront-release, deployment storefront-web, container web.
1. The Deployment keeps replicas: 6 and minReadySeconds: 5, and moves to a strategy of:
type RollingUpdate maxSurge 1 maxUnavailable 1
2. The release puts container web on image nginx:alpine, replacing the current busybox:1.36 build, and runs to completion under those bounds.
3. Three files in answers/:
observed.txt one line per sample taken WHILE the release is running:
"<replicas> <available>" - the Deployment's total replica
count and its available replica count, separated by a space.
At least four samples, and at least one of them taken while
the replacement was in progress rather than after it.
rollout-status.txt the cluster's own verdict that the release finished, naming
the deployment
replicasets.txt the ReplicaSet listing for the namespace, including the image
each one runs, taken after the release finished
Step 1 - stop shipping outages
Move storefront-web off the all-at-once strategy and onto a rolling one with the surge and unavailable bounds above. Nothing rolls yet - the template has not changed.
rolling_strategy_declares_the_surge_and_unavailable_bounds should pass
Step 2 - roll the new build and watch it happen
Put the container on the new image and sample the Deployment's replica and available counts repeatedly until the release finishes, one sample per line. Then capture the completion verdict.
release_stayed_within_the_surge_and_unavailable_bounds and rollout_status_reported_the_release_complete should pass
Step 3 - what the release left behind
Record the namespace's ReplicaSets with their images, after the release is done.
new_replicaset_scaled_up_and_the_old_one_kept_at_zero and every_serving_pod_runs_the_release_image should pass
When every test passes
You have:
- A web tier that takes a new build without a gap in service
- Bounds you chose, not defaults, deciding how much capacity a release may risk
- Sampled proof that the replacement stayed inside them
- The old ReplicaSet still sitting there at zero, which is the whole reason the next exercise is possible
You do not have yet:
- Any way back. The old ReplicaSet is retained, but nothing here names the revisions, says what changed in each, or returns to one. That is the next exercise.
Verify
Click Test after every step.
