Lab & Completion

What You Will Produce

On your own kind cluster, the proof that production runs what staging tested: the staging and production tags with one digest in the registry, the production pods pulled by that digest, and a production backend that reports the staging build it came from. Then, in lab, the production ImagePolicy built read-only against the public registry - choosing the newest production tag out of over a hundred - and the same policy pinned to the previous release, the rollback that holds while automation runs. Finally, a production rollback prepared as a Git change: accepted by the hook with the right tag, refused with a staging one, and previewed with flux diff - nothing applied unless you choose the optional step in your fork. The lab ends with lab empty and your working copy clean.

Before You Start

The baseline from Chapter 00 must be clean:

flux --context kind-sre-control-plane get kustomizations -A          # every row READY=True and SUSPENDED=False
kubectl --context kind-sre-control-plane get pods -A --no-headers | grep -vE 'Running|Completed'   # prints nothing
make smoke-test                     # Fail: 0

This chapter also needs labs/promotion/ and scripts/check-image-tags.sh in your clone, and the hooks from Chapter 05. If either path is missing, your fork must first catch up with the course repository: on GitHub, open your fork and click Sync fork → Update branch. Then git switch main && git pull - it fetches from your clone’s remote (your fork) and merges the changes into your local main; it does not sync your fork with the course repository, which is why the Sync fork step comes first.

The Lab in Four Parts

  • A. Verify - the tags in Git, their digests in the registry, the digests the pods run, the version production reports.
  • B. The Policy That Chooses - the production ImagePolicy in lab, then pinned to the previous release.
  • C. The Rollback as a Git Change - prepared, checked by the hook, previewed with flux diff; applied only in the optional fork step.
  • D. Cleanup - the lab’s objects deleted, the branch removed, the baseline proven.

Open the lab →

Done When

  • the staging and production tags from Git showed the same index digest in the registry, with one manifest per platform under it (A2-A3)
  • the staging and production pods ran that digest, and develop another one (A4)
  • production’s /version reported the staging-v… build it was promoted from (A5)
  • the ImagePolicy in lab picked the current production tag with the same digest, and pinned, resolved to the previous release (B1-B2)
  • the rollback line passed the hook, flux diff showed only the image changing, and the staging tag in production was refused (C1-C2)
  • at the end kubectl --context kind-sre-control-plane -n lab get imagerepositories,imagepolicies prints No resources found, git status --short prints nothing, and the baseline is clean (D1-D2)

Knowledge Check

Before finishing this chapter, complete the Quiz.