Skip to main content

Capstone: the whole platform, one booking

Page type · stage walkthrough
  • Repo folder: stages/stage7 at the pinned commit. Run commands from the repo root.
  • Builds on: everything from Launchpad to Stage 7. Security and cloud are still planned (Stages 8–9).
  • Read first: A passenger's booking, the chapter version of this page.

Where we are​

  • Seven stages each added one layer, and each layer exists because the one before it ran out of road.
  • This page adds nothing new. It runs the finished platform once and follows one booking through it. At every hop you'll see:
    • which object handles the hop,
    • which stage introduced it,
    • and what it replaced.

Bring up the finished platform​

kind get clusters | grep -qx apollo11 || kind create cluster --config stages/ignition/kind-config.yaml
kubectl config use-context kind-apollo11
bash stages/stage7/scripts/apply.sh --mode helm --env dev
bash stages/stage7/scripts/verify.sh --mode helm --env dev
  • What happens: Helm (Stage 5) installs the chart with the dev values: one replica per app, HPA from 1 to 3, no PDBs. The observability stack (Stage 6) and the scaling pieces (Stage 7) come with it.
  • Why Helm, not raw YAML and a script like Stage 1: the same chart serves dev, staging and prod, with only the values changing, and every install is a numbered release you can roll back.

Follow one booking​

The trace verifier creates the booking we follow here. It needs Bash 4+ (mapfile), Python 3 and OpenSSL in addition to the course toolchain. On macOS, use an installed Bash 4+ on your PATH; the system Bash 3.2 cannot run this verifier.

mkdir -p learner-work
set -o pipefail
bash stages/stage7/scripts/trace-test.sh | tee learner-work/capstone-trace.log
TRACE_ID=$(sed -n 's/^trace_id=\([0-9a-f]*\) services=.*/\1/p' learner-work/capstone-trace.log)
test -n "$TRACE_ID" && printf 'Booking trace: %s\n' "$TRACE_ID"

Require the final booking/cancellation and log/trace-correlation success lines. The script selects a seeded flight, creates a booking with that trace ID, checks the seat decrement and the four-service trace, then cancels the booking and verifies the restored seat. Its exit trap also attempts cancellation on failure. Do not create a second manual booking to explain this trace.

In two additional terminals, leave these forwards running (one per terminal):

kubectl -n apollo-observability port-forward svc/tempo 13200:3100
kubectl -n apollo-observability port-forward svc/loki 13100:3100

Back in the terminal holding TRACE_ID, inspect that same booking:

curl -fsS "http://localhost:13200/api/traces/$TRACE_ID" | \
jq '[.batches[].resource.attributes[] | select(.key == "service.name").value.stringValue] | unique'
curl -fsSG http://localhost:13100/loki/api/v1/query_range \
--data-urlencode "query={service=~\".+\"} | json | trace_id=\"$TRACE_ID\"" | \
jq -e '.data.result | length > 0'

Expect booking, identity, flight and notification in Tempo, and true for Loki. The client runs inside the cluster: this proves the application/telemetry path, while edge access is checked separately through Local Gateway and browser access. Search caching and its HPA are related passenger workflows, outside this booking trace.

#HopHandled byAdded inReplacedSee it
1Laptop → clusterMetalLB address on the GatewayStage 2One NodePort per service (Stage 1)kubectl get gateway apollo-gateway -n apollo-airlines-apps
2Host header → serviceHTTPRoute bookingStage 2Ingress rules (earlier in Stage 2)kubectl get httproute -n apollo-airlines-apps
3Route → a healthy PodService + EndpointSlice, Ready Pods onlyStage 1; readiness sharpened in Stage 4Docker DNS (Launchpad)kubectl get endpointslice -n apollo-airlines-apps -l kubernetes.io/service-name=booking
4Booking checks the token and reads the flightCluster DNS names identity, flightStage 1; cross-namespace in Stage 2Compose service namestrace: booking → identity, booking → flight
5Related search workflow (outside this trace)Redis cache-aside in searchStage 7search → flight → Postgres on every searchX-Cache: HIT on the search response; cache_hits_total
6Booking row written and keptStatefulSet booking-db + PVCStage 3emptyDir (Stage 1), lost on Pod replacementkubectl get sts,pvc -n apollo-airlines-apps
7Confirmation sentnotification, called after the writeStage 1—trace: the notification span comes after the DB write
8Search capacity (outside this trace)HPA on search CPU, using Stage 4's requestsStage 7Fixed replicas:kubectl get hpa -n apollo-airlines-apps
9Proof it all happenedAggregate Prometheus metrics; Loki logs and Tempo spans sharing this trace IDStage 6kubectl logs on one Pod at a timeGrafana → Explore, search the trace_id
  • Each layer leans on the one below:
    • The Gateway (hop 1) can only route to Pods that the Service (hop 3) lists.
    • The Service only lists Pods that pass readiness (Stage 4).
    • The HPA (hop 8) can only scale on CPU percent because Stage 4 set CPU requests.
    • You only know any of it happened because of Stage 6.
  • Which calls make the passenger wait: identity and flight are called before the response is built, so they add to the wait. Notification is called after the row is written and doesn't delay the response. In the trace, its span starts after the database work, off the critical path.

What reacts when something breaks​

If this happensWhat reactsAdded inWhat the passenger sees
A booking Pod is deletedThe ReplicaSet creates a new oneStage 1Nothing, if another replica is serving
The booking-db Pod is replacedThe StatefulSet recreates booking-db-0, which re-attaches the same PVCStage 3A short wait. The data is kept
Booking can't reach its databaseReadiness fails, and the Pod leaves the endpoints without a restartStage 4503 instead of a hung request
Booking hangsLiveness fails, and the kubelet restarts the containerStage 4A brief error, then recovery
A bad image is releasedThe rollout stalls and old Pods keep serving; then helm rollback to the last good revisionStages 1 and 5Nothing
A node is drainedThe PDB limits how many Pods leave at once (prod values; off in dev)Stage 4Nothing, with 2+ replicas
Search load growsThe search HPA can add replicas within its configured limits; booking replicas remain fixedStage 7Latency depends on cache hits, downstream capacity and available nodes
The error rate climbsThe SLO error budget burns on the dashboardStage 6Someone notices before passengers complain

Where the data lives, and what would still lose it​

kubectl get pvc -n apollo-airlines-apps
kubectl get pv -o custom-columns=NAME:.metadata.name,CLAIM:.spec.claimRef.name,RECLAIM:.spec.persistentVolumeReclaimPolicy
  • What it shows: each database has a claim, bound to a local-path volume on one node, with reclaim policy Delete.
  • What this protects against: Pod replacement (Stage 3).
  • What it does not protect against:
    • deleting the PVC (reclaim Delete removes the data),
    • losing the node (the volume is on that node's disk),
    • a bad migration or DROP TABLE (nothing to go back to).
  • What fixes those: backups you have actually restored, plus replicated or network storage. That is Stage 9 and the EKS path.

Production-shaped, not production-ready​

kubectl get pods -n apollo-airlines-apps -o custom-columns=NAME:.metadata.name,QOS:.status.qosClass
kubectl get pdb -A
kubectl get networkpolicy -A
kubectl get deploy booking -n apollo-airlines-apps -o yaml | grep -E 'runAsNonRoot|readOnlyRootFilesystem|seccompProfile' || echo "no container hardening"
ControlTodayEvidenceComes in
Requests = limits (Guaranteed QoS) on the ten workloads✅ presentqosClass columnStage 4
PodDisruptionBudgetsProd values only, none in devget pdb -AStage 4
No API token in app Pods✅ presentautomountServiceAccountToken: falseStage 1
Non-root image user✅ present in the image onlyUSER 10001:10001 in each service Dockerfile (frontend: NGINX UID 101); kubectl exec deploy/booking -n apollo-airlines-apps -- idStage 5 images
Enforced container hardening (runAsNonRoot, read-only root, seccomp, dropped capabilities)❌ absentno securityContext fields on booking; nothing stops a root imageStage 8 (planned)
NetworkPolicy❌ absentNo resources foundStage 8 (planned)
Secrets from a secret manager❌ plain Kubernetes Secretschart Secret templateStage 8 (planned)
Admission policy❌ absent—Stage 8 (planned)
Backup and restore❌ absent—Stage 9 (planned)
  • Why this matters: a control from one stage only exists later if the later stage carries it forward. A plan is not a control.

The journey, end to end​

ConcernLaunchpadIgnitionStage 1Stage 2Stage 3Stage 4Stage 5Stage 6Stage 7
Runs onOne Docker hostkind, 3 nodessamesamesamesamesamesamesame
Deploy unitCompose serviceBare PodDeploymentDeployment+ StatefulSet+ probes, resourcesHelm release+ observability stack+ HPA
Entry pointports:port-forwardNodePortIngress → Gateway API, TLSGatewayGatewayGatewayGatewayGateway
DataNamed volume—emptyDiremptyDirPVC per replicaPVCPVCPVCPVC + Redis cache
Health checksCompose healthcheck—basic probesbasic probesbasic probesstartup / live / readysamesamesame
How it's shippedcompose upkubectl applyscript + YAMLscript + YAMLscript + YAMLscript + YAMLHelm / Kustomize / Argo CDsamesame
How we know it worksdocker logskubectl getkubectl logssamesamesamesamemetrics, logs, traces, SLO+ load tests
Capacityfixedfixedfixed replicasfixedfixedrequests / limitsper-env valuesmeasuredHPA, VPA advice

Clean up​

Stop both port-forwards with Ctrl+C in their terminals, then tear down Stage 7:

bash stages/stage7/scripts/teardown.sh --mode helm --env dev --purge
kubectl get namespace apollo-airlines-apps apollo-airlines-ui apollo-observability # all NotFound

You should now be able to explain​

  • For each hop of a booking, which object handles it and which stage introduced it.
  • Why later layers depend on earlier ones (HPA on requests, Gateway on endpoints, endpoints on readiness).
  • Which controller reacts to each kind of failure, and what the passenger sees.
  • What the PVCs protect against, and the three things that would still lose the data.
  • Why this platform is production-shaped but not production-ready, using at least four rows of the controls table.

Next: Stage 8: Command Module (planned) adds security, and Stage 9 (planned) moves to the cloud.