Skip to main content

Stage 3: Mission Data

Page type · stage walkthrough
Unverified

The manifests and script descriptions below have been checked against the pinned repository snapshot. Commands and expected results have not been rerun on a live cluster for this documentation revision.

Where we left off​

  • Stage 2 gave Apollo a real front door: one Gateway IP, hostnames, TLS, and two namespaces.
  • But the data layer is still Stage 1's:
    • Data dies with the Pod. identity-db, flight-db, booking-db and redis are Deployments with emptyDir. Delete booking-db's Pod and every booking is gone. The ReplicaSet brings back a Pod, not the data.
    • Setup Jobs do not follow Pod replacement. The init-*-db Jobs ran init.sql (schema and data) once, after the database started. A replacement database Pod starts empty and nothing seeds it again.
    • Database Pods have random names (booking-db-7d9f…). Nothing can say "the first identity database" and mean the same Pod tomorrow.
  • Launchpad didn't have this problem: a Compose named volume outlived its container. Stage 3 gets that back, the Kubernetes way.

What changes in this stage​

ConcernStage 2Stage 3Why it's better
Controller for databases and RedisDeployment (random Pod names)StatefulSet (identity-db-0, flight-db-0, booking-db-0, redis-0)A stable member identity associated with its own storage
StorageemptyDir (lives and dies with the Pod)volumeClaimTemplates → one 1Gi ReadWriteOnce PVC per PodData lifetime follows the claim, not the Pod
Who provides the diskNothingThe cluster's default StorageClass (kind: rancher.io/local-path)Volumes are created on demand; no PV written by hand
DNS for databasesOne ClusterIP ServiceThe same ClusterIP Service plus a headless Service (<db>-headless)Each Pod also gets its own DNS name
SchemaInside the init-*-db JobConfigMap at /docker-entrypoint-initdb.d, run by Postgres on first start onlySchema creation runs during first initialization; existing databases need migrations
Seed dataSame Job as the schemaSeparate seed-*-db Jobs, ON CONFLICT DO NOTHINGData load is a re-runnable one-shot, separate from the structure
RedisemptyDir, no persistenceStatefulSet, PVC at /data, AOF on (--appendonly yes)Redis can reload persisted state; every-second synchronization permits recent write loss on a crash
EdgeEnvoy Gateway + MetalLB (substage 5)Same files, in k8s/gateway/ and k8s/metallb/Nothing to relearn; Traefik and the substages are gone
App DeploymentsRead values via configMapKeyRefValues inline (DATABASE_URL, ports, URLs); ConfigMap trimmedSame values; app code unchanged

What's in the folder​

PathWhat it isNew or replaces
k8s/config/Two namespaces (now labelled), ConfigMaps, Secrets, 13 ServiceAccountsSame as Stage 2
k8s/apps/<db>/<db>-sts.yamlStatefulSet for each Postgres DB and RedisReplaces k8s/infra/<db>/<db>-dep.yaml
k8s/apps/<db>/<db>-svc.yamlClusterIP Service the apps use (identity-db, …)Same as Stage 2
k8s/apps/<db>/<db>-svc-headless.yamlHeadless Service (clusterIP: None)New
k8s/apps/<db>/<db>-init-script.yamlSchema SQL in a ConfigMap, mounted into PostgresReplaces the schema half of k8s/jobs/*-init-configmap.yaml
k8s/jobs/seed-*-db.yaml + *-db-seed.yamlSeed Jobs and their SQL ConfigMapsReplaces init-*-db Jobs
k8s/apps/<service>/The six app Deployments and ServicesSame as Stage 2 (values inlined)
k8s/gateway/, k8s/metallb/Envoy Gateway and MetalLBCopied from Stage 2 substages 4–5
scripts/apply.shSeven phases: config → StatefulSets and wait → seed → app Deployments → MetalLB → Envoy Gateway → routesReplaces Stage 2's --substage script
scripts/generate-certs.sh, verify.sh, verify-tls.sh, teardown.shCertificate, checks, clean removalMoved out of the Traefik folder

Walkthrough​

Step 1: Replace Stage 2 and apply​

kubectl config current-context # must be kind-apollo11
bash stages/stage2/scripts/teardown.sh # Stage 3 is a snapshot, not a patch
bash stages/stage3/scripts/apply.sh # add --skip-build to reuse loaded images

apply.sh runs seven phases:

  1. Namespaces, config, Secrets, ServiceAccounts.
  2. The four StatefulSets with their Services and schema ConfigMaps. Wait for each StatefulSet and its -0 Pod to be Ready.
  3. Run the three seed-*-db Jobs and wait for Complete.
  4. The six app Deployments and their Services. Wait for each rollout.
  5. MetalLB and its IP pool.
  6. Envoy Gateway (server-side apply).
  7. GatewayClass, EnvoyProxy, the TLS Secret if missing, Gateway, ReferenceGrant, six HTTPRoutes. Then wait for Programmed and the MetalLB IP.
  • Why tear down Stage 2: its identity-db Deployment and the new identity-db StatefulSet would both carry app: identity-db. The identity-db Service would send traffic to both an empty-dir database and the persistent one.
  • Why the order: on a successful first initialization, the Postgres entrypoint creates the schema before starting its normal network server. The script waits for the databases before launching seed Jobs, and starts the apps only after the seeds complete, so the first app Pods meet populated databases. Each seed Job also gives up after 30 pg_isready attempts (about a minute) instead of waiting forever. The pg_isready probe checks connection status, not tables: partial initialization or an incompatible existing schema can still make a seed fail. Inspect Job logs rather than treating Ready as schema validation.
  • Compared with Stage 2: the edge isn't "kept running" from Stage 2; this stage installs the same MetalLB and Envoy Gateway files again. The frontend is always built with https://<svc>.apollo.local URLs.

Step 2: Read one StatefulSet​

Open identity-db-sts.yaml and identity-db-svc-headless.yaml:

# identity-db-sts.yaml (trimmed)
kind: StatefulSet
spec:
serviceName: identity-db-headless # the headless Service that gives each Pod a DNS name
replicas: 1
template:
metadata:
labels: {app: identity-db, tier: data}
spec:
containers:
- name: postgres
image: postgres:15-alpine
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata # a subdirectory of the mounted volume
volumeMounts:
- {name: pg-data, mountPath: /var/lib/postgresql/data} # from the claim template
- {name: init-script, mountPath: /docker-entrypoint-initdb.d} # schema SQL
volumes:
- name: init-script
configMap: {name: identity-db-init-script}
volumeClaimTemplates: # "give each Pod its own claim from this shape"
- metadata: {name: pg-data}
spec:
accessModes: ["ReadWriteOnce"] # one node may mount it read-write
resources: {requests: {storage: 1Gi}}
# no storageClassName: the cluster default is used
---
# identity-db-svc-headless.yaml
kind: Service
spec:
clusterIP: None # "headless": DNS returns Pod IPs, no virtual IP
selector: {app: identity-db}
ports: [{port: 5432, targetPort: 5432}]
  • What a StatefulSet is: a controller like a Deployment, but each Pod has a fixed identity: an ordinal name (identity-db-0), its own claim, and its own DNS name. A replacement Pod gets the same name and the same claim.
  • What a PVC is: a PersistentVolumeClaim is a request: "1Gi, mountable read-write by one node". A PersistentVolume (PV) is the actual storage that satisfies it. A StorageClass says how to create PVs on demand.
  • Why volumeClaimTemplates and not a volumes: entry: a volumes: entry would point every replica at one named claim. The template stamps out a claim per Pod, named <template>-<statefulset>-<ordinal>: pg-data-identity-db-0.
  • Why PGDATA is a subdirectory: the Postgres entrypoint only initialises a database in an empty PGDATA. Pointing it at …/data/pgdata inside the mount keeps that check clean on a fresh volume.
  • Compared with Stage 2: the Pod template is almost the same Postgres container. What changed is the controller, the volume source (emptyDir: {} → claim template), and the schema mount. The app Deployments still connect to identity-db:5432, so no app code changed.

Step 3: Follow the chain down to the bytes​

kubectl get sts,pods -n apollo-airlines-apps -l tier=data
kubectl get pvc -n apollo-airlines-apps
kubectl get sc
PV=$(kubectl get pvc pg-data-identity-db-0 -n apollo-airlines-apps -o jsonpath='{.spec.volumeName}')
NODE=$(kubectl get pod identity-db-0 -n apollo-airlines-apps -o jsonpath='{.spec.nodeName}')
VOLUME_PATH=$(kubectl get pv "$PV" -o jsonpath='{.spec.hostPath.path}{.spec.local.path}')
kubectl get pv "$PV" -o yaml # nodeAffinity, reclaim policy, and backing path
docker exec "$NODE" ls "$VOLUME_PATH/pgdata" | head -5
  • What you see:
    • Pods identity-db-0, flight-db-0, booking-db-0, redis-0, all 1/1.
    • PVCs pg-data-identity-db-0, pg-data-flight-db-0, pg-data-booking-db-0, redis-data-redis-0, all Bound, 1Gi, RWO.
    • The default StorageClass uses provisioner rancher.io/local-path (named standard in kind).
    • The PV is a host directory under /var/local-path-provisioner/…, pinned to one node by nodeAffinity, with reclaim=Delete.
    • Inside it: PG_VERSION, base, pg_wal. Postgres's real files on the node's disk.
    • 1Gi is the requested capacity; local-path does not enforce a per-directory size limit. Free space still depends on the node's filesystem.
  • The relationships: the StatefulSet creates a PVC from its template; the StorageClass selects the provisioner; the provisioner creates a node directory and a PV; the PVC binds to that PV. The StorageClass is configuration, not a hop between the Pod and its files.
  • Why this way: following the claim to its PV and directory distinguishes the API request from the stored files. The default class delays binding with WaitForFirstConsumer. Provisioning waits until scheduling identifies a suitable node, so the volume is created where the Pod can use it. Binding and mounting then complete before the container starts. A Pending PVC before that is normal.
  • What this does not give you: local-path is a plain directory. No replication, no snapshot, no backup. It survives Pod replacement while the original node directory remains available. A temporary node outage makes it unavailable; destroying that directory loses the data.

Step 4: See how schema and seed data are now split​

kubectl exec -n apollo-airlines-apps identity-db-0 -- ls /docker-entrypoint-initdb.d # init.sql
kubectl logs -n apollo-airlines-apps identity-db-0 | grep -iE "running /docker-entrypoint-initdb.d|skipping initialization"
kubectl get jobs -n apollo-airlines-apps # seed-identity-db, seed-flight-db, seed-booking-db
kubectl exec -n apollo-airlines-apps identity-db-0 -- psql -U postgres -d identity -tAc "SELECT count(*) FROM users;" # 2

From identity-db-init-script.yaml, seed-identity-db.yaml and identity-db-seed.yaml:

The schema ConfigMap contains the initial table definitions. The Job runs the following command inside a separate PostgreSQL client container; this excerpt is copied from seed-identity-db.yaml:

# Under spec.template.spec.containers[0]
command:
- sh
- -c
- |
set -eu
attempt=0
until pg_isready -h identity-db -U postgres; do
attempt=$((attempt + 1))
if [ "${attempt}" -ge 30 ]; then
echo "identity-db did not become ready" >&2
exit 1
fi
echo "Waiting for identity-db... (${attempt}/30)"
sleep 2
done
psql -h identity-db -U postgres -d identity -v ON_ERROR_STOP=1 -f /init/seed.sql
echo "identity DB seeded"
  • The Job mounts the identity-db-seed ConfigMap at /init, making its seed.sql available at the path above.

  • PGPASSWORD comes from apollo-airlines-secrets. The SQL ends with ON CONFLICT (id) DO NOTHING, leaving an existing matching user unchanged.

  • ON_ERROR_STOP=1 makes a SQL error fail the command instead of being mistaken for a completed seed.

  • The wait loop is bounded: after 30 attempts the container exits non-zero, so the Job records a failure you can read with kubectl logs job/seed-identity-db instead of hanging until someone notices.

  • Schema, via the entrypoint hook: the official Postgres image runs every file in /docker-entrypoint-initdb.d only when the data directory is empty. A fresh volume gets the tables. Every later start logs "Skipping initialization" and leaves the data alone.

  • Seed data, via a Job: on a fresh install, two users, six airports, and 31 days of flights (186 rows). Later seed runs can add future departures as the date advances. Every insert ends in ON CONFLICT … DO NOTHING (id for users, code for airports, (flight_number, departure_time) for flights, matching the table's unique constraint), so rerunning the Job never duplicates a row. The booking seed is just SELECT 1: bookings are created at runtime.

  • Why not an init container for the schema: an init container must finish before the Postgres container starts. One that waits for pg_isready on 127.0.0.1 waits for a server that can't start until it exits. Neither moves. The comment at the top of the StatefulSet file records this.

  • Why split schema from data: the structure belongs to every copy of the database, so it travels with the Pod's first start. The data load is an operation you choose to run, so it stays a Job.

  • Compared with Stage 2: one init-*-db Job did both, once, with restartPolicy: Never. If its database came back empty, nothing recreated even the tables.

Step 5: See the data survive a Pod replacement​

The following Bash block writes a temporary user with a generated ID, records the current Pod UID and PV name, and replaces the database Pod. Identity requests can fail briefly while its single database member restarts.

(
set -euo pipefail
NS=apollo-airlines-apps
Q() { kubectl exec -n "$NS" identity-db-0 -- \
psql -U postgres -d identity -v ON_ERROR_STOP=1 -qAtc "$1"; }

OLD_UID=$(kubectl get pod identity-db-0 -n "$NS" -o jsonpath='{.metadata.uid}')
OLD_PV=$(kubectl get pvc pg-data-identity-db-0 -n "$NS" -o jsonpath='{.spec.volumeName}')
PROBE_ID=$(Q "INSERT INTO users (email,password_hash,first_name,last_name)
VALUES ('persistence-' || gen_random_uuid()::text || '@apollo.local',
'not-a-login-hash','Storage','Check') RETURNING id;")
test -n "$PROBE_ID"
printf 'Temporary user ID: %s\n' "$PROBE_ID"

kubectl delete pod identity-db-0 -n "$NS" --wait=true
kubectl wait --for=create pod/identity-db-0 -n "$NS" --timeout=90s
kubectl wait --for=condition=Ready pod/identity-db-0 -n "$NS" --timeout=90s

NEW_UID=$(kubectl get pod identity-db-0 -n "$NS" -o jsonpath='{.metadata.uid}')
NEW_PV=$(kubectl get pvc pg-data-identity-db-0 -n "$NS" -o jsonpath='{.spec.volumeName}')
test "$OLD_UID" != "$NEW_UID"
test "$OLD_PV" = "$NEW_PV"
test "$(Q "SELECT id FROM users WHERE id='$PROBE_ID';")" = "$PROBE_ID"
printf 'New Pod UID; same PV; same user ID.\n'

Q "DELETE FROM users WHERE id='$PROBE_ID';"
)
  • What happens: the Pod name returns as identity-db-0, but its UID changes. The PVC still points to the original PV, and the database returns the exact user ID inserted before replacement. All three checks must pass before the success line prints.
  • Why this way: the generated row cannot be recreated by Apollo's seeds. Checking it separately from the PV name proves that the new Pod reopened the database contents. Waiting for creation first covers the interval when the old Pod is gone and its replacement does not yet exist.
  • Cleanup: the final SQL statement removes only this run's temporary user. If the block stops early, use the printed ID to inspect and remove that user after the database recovers. The placeholder password hash is not a usable login credential.
  • Compared with Stage 1 and 2: replacing a database Pod removed its emptyDir. Here the replacement reuses a claim whose lifetime is independent of the Pod.

What each operation does to the data (all on identity-db):

OperationData survives?Why
Delete the PodYes, same PVReplacement has the same name, so the same claim
Scale the StatefulSet to 0, then 1Yes, same PVApollo's default claim retention keeps the PVC Bound with no Pod
Delete the StatefulSet and re-apply itYes, same PVApollo's default claim retention keeps its PVCs
Delete the PVCNo, after deletion completesreclaim=Delete removes backing storage. A subsequently created claim gets an empty volume; initialization recreates tables, and seeds can recreate only demo rows
Delete the namespace (teardown.sh)NoThe PVCs go with the namespace, and their PVs with them
Destroy the node's storageNolocal-path data is only on that node
  • The boundary: Pod replacement preserves the files when the same claim and node directory remain usable. Logical deletes and corruption are persisted too; keeping a volume does not undo them.
  • A PVC in use doesn't vanish at once: a kubectl delete pvc sits in Terminating (the kubernetes.io/pvc-protection finalizer) until no Pod uses it.
  • What would keep the data after a PVC delete: persistentVolumeReclaimPolicy: Retain. The PV then becomes Released with data intact, and an administrator must recover and rebind it before reuse. Real protection is a backup you have restored at least once: Recovery boundaries.

Step 6: See the two DNS names​

NS=apollo-airlines-apps
R() { kubectl exec -n "$NS" deploy/identity -- getent hosts "$@"; }
kubectl get pod identity-db-0 -n $NS -o jsonpath='{.status.podIP}{"\n"}'
R identity-db # the ClusterIP (10.96.x.x)
R identity-db-headless # the Pod IP
R identity-db-0.identity-db-headless # the Pod IP, by Pod name
  • What you see: the normal Service returns its virtual IP. Headless lookups return the ready Pod's IP; compare it with the Pod output. After replacement, the Pod IP can change while the Service IP stays the same. DNS answers may briefly lag because of caching, and an unready Pod is normally omitted.
  • Why this way: a normal Service load-balances, which is right for clients that don't care which replica answers. A headless Service publishes one record per Pod, so identity-db-0.identity-db-headless always means that one Pod. That is what replication and database operators need.
  • What Apollo uses: the apps connect to identity-db (the normal Service), exactly as in Stage 2. The headless Service is there because the StatefulSet's serviceName needs it, and for future replicas.
  • Why getent: the identity image (python:3.12-slim) has no nslookup. Apollo's identity image includes getent hosts; other minimal images may need a different DNS tool.
  • Not a replicated database: scaling to replicas: 2 would give identity-db-1 its own claim and its own separate database (tables from the init script, none of -0's rows). A StatefulSet gives identity and storage, not replication.

Step 7: See that the volume also pins the Pod to a node​

kubectl get pod identity-db-0 -n apollo-airlines-apps -o wide # NODE column
kubectl get pv $(kubectl get pvc pg-data-identity-db-0 -n apollo-airlines-apps -o jsonpath='{.spec.volumeName}') \
-o jsonpath='{.spec.nodeAffinity}{"\n"}'
  • What it means: a local-path PV can only be used on its node, so the scheduler must put identity-db-0 there, every time.
  • Why this way: node affinity keeps the replacement attached to its existing files. If that node is unavailable or cordoned, a replacement identity-db-0 cannot use another node's directory and may stay Pending. Read the Pod events: a cordoned node may be reported as unschedulable, while another node may show a volume affinity conflict. Restore access to the original node when possible. Recreating a claim allocates new storage and cannot recover the old files.
  • Compared with Stage 2: an emptyDir database could start on any node, because it started empty anyway. Persistence on node-local disk trades freedom of placement for data that stays. Network-attached volumes (EBS, Persistent Disk) can move between nodes; that is a cloud topic for Stage 9.

Step 8: Check the edge and the full workflow​

GW=$(kubectl get service -n envoy-gateway-system \
-l gateway.envoyproxy.io/owning-gateway-name=apollo-gateway \
-o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}')
kubectl get secret apollo-tls-secret -n apollo-airlines-apps \
-o jsonpath='{.data.tls\.crt}' | base64 -d > /tmp/apollo-ca.crt
curl --fail-with-body --show-error --silent --max-time 15 \
--cacert /tmp/apollo-ca.crt --resolve "identity.apollo.local:443:$GW" \
-o /dev/null -w 'identity readyz=%{http_code}\n' \
https://identity.apollo.local/readyz
bash stages/stage3/scripts/verify-tls.sh
bash stages/stage3/scripts/verify.sh
  • What you see: identity readyz=200 for a successful HTTPS request. verify-tls.sh checks trusted HTTPS, hostname rejection, login, populated search, booking, and cancellation. verify.sh also checks StatefulSets, PVCs, headless DNS, seed counts, a booking surviving booking-db-0 replacement, and a Redis key surviving redis-0 replacement (the AOF check). It reports 70 checks on a passing run.
  • Why this way: --resolve directs the hostname to MetalLB's current IP while preserving TLS hostname verification. (On Docker Desktop for macOS/Windows where MetalLB IPs are not host-routable, refer to Local Gateway and browser access for port-forwarding or containerized verification.) The certificate is read from this installation's Secret, since teardown and reapply can replace it. An HTTP redirect alone would not prove the HTTPS route works.
  • Compared with Stage 2: the access mechanism is the same, but the verifier now checks storage and a record surviving replacement. The built-in readiness endpoint alone does not prove data survival.
  • Verification scope: the verifier replaces booking-db-0, causing another brief database outage. Its booking check covers Pod replacement with the original volume; it does not prove backup restoration. See Recovery boundaries.

When something looks wrong​

You seeLikely causeFirst command
PVC Pending, event "waiting for first consumer"Normal with WaitForFirstConsumer until a Pod uses itkubectl describe pvc <name> -n apollo-airlines-apps
PVC Pending, storageclass … not found / ProvisioningFailedMissing class or provisioning failure; inspect before changing a claim holding datakubectl describe pvc <name> -n apollo-airlines-apps; kubectl get sc
DB Pod Pending, "volume node affinity conflict"The PV's node is cordoned, drained or gonekubectl describe pod <db>-0 -n apollo-airlines-apps → Events; kubectl get nodes
PVC stuck TerminatingA Pod still mounts it (pvc-protection)kubectl get pods -n apollo-airlines-apps -l app=<db>
Login fails, users table emptyFresh volume got schema but seed Job didn't rerunkubectl get jobs -n apollo-airlines-apps; kubectl logs -n apollo-airlines-apps job/seed-identity-db
A new column or table in the init ConfigMap never appearsInit scripts only run on an empty data directorykubectl logs -n apollo-airlines-apps <db>-0; existing DBs need a migration
Service identity-db has two endpointsStage 2's Deployment is still running next to the StatefulSetkubectl get deploy,sts -n apollo-airlines-apps
StatefulSet stuck 0/1Postgres not starting; check logs before probeskubectl logs -n apollo-airlines-apps <db>-0; kubectl describe pod -n apollo-airlines-apps <db>-0

The troubleshooting page has more.

What this stage does not solve yet​

Limitation you can see nowWhy it hurtsFixed in
Probes are basic; a slow first start and a hung process look alikeThe kubelet can't tell "starting" from "stuck"Stage 4: startup, liveness and readiness probes
No resource requests or limits; no PodDisruptionBudgetsPlacement lacks resource reservations; voluntary disruptions can interrupt serviceStage 4: requests/limits, PDBs
Data lives on one node's disk, one copyDestruction of that node's storage loses the filesStage 9 (planned): cloud volumes
No backup or restoreThere is no recovery copy after volume deletionStage 9 (planned): Velero
Schema changes need a manual migrationInit scripts don't rerun on existing dataNot covered in the verified stages
Dozens of YAML files applied by a scriptRepeated values; no environments; no release historyStage 5: Helm, Kustomize, Argo CD
Any Pod can reach any databaseNo network rules between namespaces or tiersStage 8 (planned): NetworkPolicies

The journey so far​

ConcernLaunchpadIgnitionStage 1Stage 2Stage 3
Runs onOne Docker hostThree-node kind clusterSame clusterSame clusterSame cluster
Unit of deploymentCompose serviceBare PodDeploymentDeploymentDeployment (apps) + StatefulSet (data)
Recoveryrestart: on one hostNoneReplicaSet replaces PodsSameSame Pod name, same volume
Namespaces—defaultapollo-airlinesapollo-airlines-apps / -uiSame
Service discoveryDocker DNSPod IP onlyService + cluster DNSCross-namespace DNS names+ headless per-Pod names
External accessports:kubectl port-forwardNodePortEnvoy Gateway on a MetalLB IPSame
TLSNoneNoneNoneWildcard cert at the GatewaySame
Config / secretsenvironment:Inline in pod.yamlConfigMap / SecretOne copy per namespaceSame
DataNamed volume—emptyDir (ephemeral)emptyDir (ephemeral)PVC per Pod (local-path, 1Gi)
Schema and seedinit.sql mount—One Job per DBOne Job per DBEntrypoint hook + seed Job

The teardown now also audits and removes owned Gateway API, Envoy Gateway and MetalLB cluster resources. If custom resources outside this stage still use those CRDs, it retains the shared definitions and exits with a list of those resources. Inspect that list before continuing; namespace deletion alone is not proof of a clean teardown.

Clean up​

bash stages/stage3/scripts/teardown.sh # deletes the namespaces; PVCs and their PVs go too
kubectl get ns apollo-airlines-apps apollo-airlines-ui envoy-gateway-system metallb-system # all NotFound
kubectl get pv # no apollo claims left

Teardown deletes the data. That is intended: the next stage starts from its own snapshot. The kind cluster stays.

You should now be able to explain​

  • Why identity-db-0 comes back with its data when Stage 2's database did not.
  • How a StatefulSet's claim template becomes a PVC, a PV and a directory on one node.
  • Which operations retain the claim under Apollo's defaults, and why deleting a claim or destroying its backing storage loses files.
  • Why the schema runs from /docker-entrypoint-initdb.d and the seed runs as a Job, and why an init container would deadlock.
  • What a headless Service returns, and why the apps still use the normal one.
  • Why node-local storage pins a database Pod to one node.

Next: Stage 4: Flight Control teaches the kubelet to tell "starting" from "stuck" and explains resource reservations and disruption controls. The databases still have one member and node-local storage.