Lab & Completion

What You Will Produce

On your own kind cluster, the frontend released as a canary. You check that Prometheus has Traefik’s request metrics, then switch the canary on through a pull request and see who serves users now. A healthy release walks from 10% to 50% of the requests and is promoted on its own numbers. A release that fails three requests in ten is rolled back at a small share of the traffic - you measure that share, see that the requests the stable version served got only 200, and see the alert that says a release was rejected. Then the fix goes through the canary too, and the canary is switched off with the plain rollout back.

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 curl, 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 observability get podmonitor traefik finds nothing, 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 - Flagger, Traefik’s metrics in Prometheus, and the canary module still off.
  • B. Break & Fix - the canary switched on; a healthy release promoted; a broken release rolled back, its reach measured, its alert seen.
  • C. Rollback & Cleanup - the fix through the canary, the canary switched off, the baseline.

Open the lab →

Done When

  • Prometheus has Traefik’s metrics, and you can say why the analysis needs them (A2)
  • your prediction was written before B2 (B1)
  • after the switch-on, frontend-primary served and frontend was at 0, and synthetic requests reached the primary through Traefik (B2)
  • the healthy release went 10% → 50% and was promoted, and you can name each step from the events (B3)
  • the broken release was rolled back by Flagger with a success rate below 99% in its events, while requests to the primary got only 200 (B4)
  • you measured what share of all requests failed, and compared it with Chapter 15 (B5)
  • CanaryRolledBack fired (B6)
  • the fix was promoted through the canary, the canary was switched off, frontend serves again and the baseline is clean (C1-C3)

Knowledge Check

Before finishing this chapter, complete the Quiz.