Lab & Completion
What You Will Produce
On your own kind cluster, a restore you can prove. You check that the backups exist, that every change is archived, that a restore cluster has a path out of the default-deny namespace, and that alerts watch the backups. Then you write a row you know, take a fresh backup, write one more row and note the moment - and delete them all, the way the incident did. A point-in-time restore to that moment, into a new cluster next to the old one, brings both rows back; you prove it with the application’s own user - read and write - and you measure how long the restore took. The lab ends with the restore cluster, the lab backup and the lab table removed.
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 one terminal for the whole of Part B - it keeps two values (BK, T) between steps - and jq. If scripts/postgres-restore-manifest.sh does not exist in your clone, your fork is older than the chapter: on GitHub, open your fork and click Sync fork → Update branch, then git switch main && git pull, and let Flux catch up.
The Lab in Three Parts
- A. Verify - the backups, the WAL archive, the restore path through the network policies, the alerts that watch it all.
- B. Break & Fix - a known row, a fresh backup, the moment before the damage, the damage, a point-in-time restore next to the original, the proof with the app’s user - and a major upgrade of a database of its own.
- C. Rollback & Cleanup - the restore cluster, the lab backup and the lab table removed, the baseline proven.
Done When
- the backups list showed
completedbase backups, and the clusterContinuousArchiving=Truewithfailed_count0 (A2-A3) - the Postgres network policies select
app-postgresandapp-postgres-restore(A4) - the four backup alerts are loaded (A5)
- your lab backup reached
completed, and the WAL segment with the damage was archived (B2, B4) - the restore to your moment
TreachedReady, and you wrote down how long it took (B5) - with the app’s user, the restore showed rows 1 and 2 and accepted row 3, while the original showed none (B6)
- the 17 cluster went through
Upgrading Postgres major versionto 18, and the row written on 17 was still there (B7) - the restore cluster, the lab backup and the lab table are gone, and the baseline is clean (C1-C2)
Knowledge Check
Before finishing this chapter, complete the Quiz.