Lab & Completion
What You Will Produce
On your own kind cluster, a release with a migration taken through everything this chapter covers. First you read the schema version the database has and the log of the initContainer that applied it. A user registers with a display name that the backend writes but does not return yet; one pull request switches it on. Then you break the schema the way the story’s release did, roll the image back and watch it not help - and fix the schema by rolling forward. The rollback to the previous release keeps every display name written before it. A list of users shows what a point-in-time restore to before the change would have deleted. At the end the current release is back, the flag is off and the lab users are gone.
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
You need gh, jq and yq (make check-tools), and a Flux that follows your fork (Chapter 15, A2). Your fork must be up to date: if kubectl --context kind-sre-control-plane -n develop get deploy backend -o jsonpath='{.spec.template.spec.initContainers[*].name}' does not print migrate, open your fork on GitHub, click Sync fork → Update branch, then git switch main && git pull, and let Flux catch up.
The Lab in Three Parts
- A. Verify - the schema version, the initContainer’s log, the flags, and the two releases you will switch between.
- B. Break & Fix - a column written before it is read; a flag switched on; a breaking schema change that an image rollback does not fix; the roll forward that does; a rollback that keeps the data; what a restore would have cost; the current release back.
- C. Rollback & Cleanup - the flag off, the lab users deleted, the baseline.
Done When
- you can say which schema version
develophas, who applied it and what the app checks at startup (A2-A3) - your prediction was written before B2 (B1)
- a display name was stored while the flag was off, and returned only after the flag’s pull request (B2-B3)
- after the breaking change, the image rollback ran -
nothing to applyin its log - and logins still failed (B4-B5) - the roll forward fixed logins on the previous release, and the display names written before the rollback were still there (B6)
- you listed the users a restore to before the break would have deleted (B7)
- the current release is back, with
schema already at version 2and the display name returned (B8) - the flag is off, no
lab18-user is left and the baseline is clean (C1-C2)
Knowledge Check
Before finishing this chapter, complete the Quiz.