Skip to main content

Stage 7: Orbital Maneuvering

Page type · stage walkthrough

Where we left off​

  • Stage 6 gave Apollo metrics, dashboards, a booking SLO, logs and traces. For the first time we can measure.
  • The measurements show two problems:
    • Search repeats the same work. Every /api/search call becomes a call to flight, which queries flight-db. Ten passengers searching BOM → SIN for the same date cause ten identical database reads. In Prometheus, flight's /api/flights request rate tracks search's rate one-for-one. In Tempo, every search trace has a search → flight span.
    • Replica counts are fixed. Stage 5's values set them per environment: dev 1, staging 2, prod 3, whatever the traffic. At quiet times those Pods sit idle (the Service Runtime dashboard shows it). In a spike, the same number of Pods must take everything, and booking's p95 and error ratio are what suffer.
  • One more gap: Stage 4's CPU and memory requests were educated guesses (search: 100m CPU, 128Mi). Nothing tells us whether they are right.
  • And kubectl top pods returns an error: kind has no metrics-server, so Kubernetes itself has no CPU numbers for Pods.

Stage 7 fixes these in a fixed order: measure first, then cache, then scale out, then get advice on sizing.

What changes in this stage​

ConcernStage 6Stage 7Why it's better
Repeated searchessearch → flight → flight-db, every timeCache-aside in Redis: key search:<origin>:<destination>:<date>, TTL 300 sIdentical searches are answered from memory; flight and its database see less load
Knowing if it workedDashboards, but no repeatable loadk6 benchmark: fixed rate, fixed routes, cache off vs onOne variable changes; the result is a measurement, not an impression
Cache visibility—X-Cache: HIT/MISS header, cache_hits_total / cache_misses_total, cache.get / cache.set spansThe Stage 6 signals now show the cache's effect too
Pod CPU numbers for KubernetesNone (kubectl top fails)metrics-server v0.8.1 in kube-systemThe metrics.k8s.io API the HPA reads
Number of search PodsFixed per environmentHPA search-hpa: CPU target 70%, chart default 2–10, dev 1–3, prod 3–20 at 60%Replicas follow load: more in a spike, fewer when quiet
Right-sizing requestsStage 4 guess, never revisitedVPA search-vpa with updateMode: "Off" (staging/prod only)Recommendations from real usage, applied by a person
Where search Pods landTopology spread (from Stage 4)+ toleration for workload=search:NoSchedule + preferred node affinity for apollo11.io/search-pool=dedicatedSearch can use a dedicated node pool without depending on it
Priority classesDefined since Stage 4Same classes, now set per service in valuesBooking and search are apollo-airlines-app-critical; notification is apollo-airlines-app-low

What's in the folder​

diff -r stages/stage6 stages/stage7 shows that only search's code changed. Every other service is the Stage 6 code.

PathWhat it isNew or replaces
code/search/main.go, go.modRedis client (go-redis/v9), cache-aside, X-Cache, cache counters and spans, cache state in readinessChanges Stage 6's search
code/search/cache_test.go, handler_test.goCache configuration plus HTTP handler, expiry, concurrency and recovery testsNew
k6/capacity.js, PERFORMANCE.mdNormal-policy capacity run, cache correctness and staging VPA procedureNew
helm/apollo11/templates/autoscaling/search-hpa.yamlThe HPANew
helm/apollo11/templates/autoscaling/search-vpa.yamlThe VPA, Off modeNew
helm/apollo11/templates/autoscaling/metrics-server-install.yaml, vpa-install.yaml + bundles/metrics-server v0.8.1 (with kind's --kubelet-insecure-tls); VPA 1.7.0 recommender and updater, no admission webhookNew
helm/apollo11/templates/apps/search.yaml+ CACHE_ENABLED, REDIS_URL, toleration, node affinity; topology spread now from valuesChanges Stage 6's
helm/apollo11/values.yaml+ redis.url, redis.cache.ttlSeconds, autoscaling, vpa, priorityClasses names/values, search schedulingExtends Stage 6's
helm/apollo11/values-dev.yaml / values-prod.yamlDev: HPA 1–3, VPA off. Prod: HPA 3–20 at 60%, VPA onExtends Stage 6's
overlays/dev/kustomization.yamlSame dev changes for the Kustomize path: patches the HPA to 1–3 and deletes the VPAExtends Stage 6's
k6/search.js, k6/README.mdThe search benchmark and its procedureNew
scripts/apply.shInstalls metrics-server (and VPA outside dev) before the chartExtends Stage 6's
scripts/scaling-lab.shReal load → HPA scale-out across workers → scale-in, then restores everythingNew
—signals-lab.sh, slo-lab.sh, select-signals.pyRemoved: the observability stack now installs in one go

Walkthrough​

export KUBE_CONTEXT=kind-apollo11

Keep the exercises in this order. Each later one changes state (replica counts, HPA settings, observability) that would spoil an earlier measurement:

  1. Install and verify dev (Step 1).
  2. The single-replica cache benchmark (Steps 3–4), before any HPA load.
  3. Normal-policy capacity and cache correctness, including the Redis outage drill and the staging VPA exercise (Step 7).
  4. HPA and scheduling under load with scaling-lab.sh (Steps 5–6), on an installed stack with at least two node-role=worker nodes.
  5. The inherited observability exercises, then teardown.sh --purge.

Step 1: Deploy, and see what's new in the cluster​

bash stages/stage7/scripts/apply.sh --env dev
kubectl get deploy metrics-server -n kube-system
kubectl top pods -n apollo-airlines-apps -l app=search # works now
kubectl get hpa search-hpa -n apollo-airlines-apps
  • What happens: apply.sh installs the Stage 6 stack as before, plus metrics-server. In dev it skips the VPA bundle. The HPA starts reporting TARGETS like 3%/70% within about 30 s.
  • What metrics-server is: a small cluster add-on that collects CPU and memory from each kubelet and serves them as the metrics.k8s.io API. kubectl top and the HPA both read it.
  • Why not use Prometheus for this? Prometheus (Stage 6) is for people and alerts. The HPA reads the standard resource-metrics API, which metrics-server provides. Two consumers, two purposes.

Step 2: Read the cache-aside code​

search/main.go, trimmed:

cacheKey := fmt.Sprintf("search:%s:%s:%s", origin, destination, date) // same 3 inputs = same answer

cacheClient, _ := getRedisClient(ctx, time.Second) // nil if CACHE_ENABLED=false or Redis is down
if cacheClient != nil {
_, cacheSpan := tracer.Start(ctx, "cache.get", ...) // shows up in the Stage 6 trace
cached, cerr := cacheClient.Get(cacheCtx, cacheKey).Result() // 1 s timeout
if cerr == nil {
cacheHitsTotal.WithLabelValues("search").Inc()
c.Header("X-Cache", "HIT")
c.String(http.StatusOK, cached) // flight is never called
return
}
}
cacheMissesTotal.WithLabelValues("search").Inc()
// ... call flight, build the result ...
cacheClient.Set(setCtx, cacheKey, payloadBytes, time.Duration(cacheTTLSeconds)*time.Second) // 300 s unless CACHE_TTL_SECONDS says otherwise
c.Header("X-Cache", "MISS")
  • What cache-aside means: the application, not Redis, decides. Look in the cache; on a miss, ask the source of truth (flight) and store the answer with an expiry (TTL).
  • Why a TTL and not "update the cache when a seat is booked": search results can be up to 5 minutes old without harm. Booking never reads this cache; it asks flight directly for seats. A TTL keeps the design simple and bounds how stale an answer can be.
  • Why the cache is optional: every Redis call has a 1 s timeout. On any error the code logs a warning and treats it as a miss. Redis failing makes search slower, not broken.
  • Why Redis is already there: Redis has been a StatefulSet with a PVC since Stage 3, used by notification. Stage 7 reuses it (REDIS_URL=redis://redis:6379).
  • CACHE_ENABLED: set from apps.search.cacheEnabled in values. Setting it to false turns the cache off without a new image. Step 3 uses that for the baseline.

Step 3: Measure the baseline before turning the cache on​

A change is only "better" against a measured "before". The k6 README holds the full procedure, with a trap that restores everything on exit. Its core:

NS=apollo-airlines-apps
kubectl port-forward -n $NS svc/search 18083:8083 >/dev/null 2>&1 & # bypass the Gateway: measure the app, not TLS
kubectl delete hpa search-hpa -n $NS # pause autoscaling: replica count must not change mid-run
kubectl scale deploy/search -n $NS --replicas=1
export SEARCH_DATE=$(date -u +%F)

kubectl set env deploy/search -n $NS CACHE_ENABLED=false
kubectl rollout status deploy/search -n $NS # restart the port-forward if the rollout ended it
BASE_URL=http://localhost:18083 EXPECT_CACHE=off \
k6 run --summary-export baseline-summary.json stages/stage7/k6/search.js

What search.js holds fixed:

const ROUTES = [['BOM','SIN'], ['SIN','BOM'], ['DEL','DXB'], ['DXB','DEL'], ['BOM','LHR'], ['DEL','JFK']];
scenarios: { search: { executor: 'constant-arrival-rate', rate: 50, timeUnit: '1s', duration: '2m' } },
thresholds: {
checks: ['rate==1'], // every response must contain real flights
http_req_duration: ['p(95)<200'], // lab acceptance criteria, not an SLO
dropped_iterations: ['count==0'], // every planned request started: no VU shortage from slow responses
cache_hit_rate: EXPECT_CACHE === 'off' ? ['rate==0'] : ['rate>0.9'],
},
// setup() warms the six keys first; that traffic is not measured
  • What a fair comparison needs: same image, date, routes, request rate and replica count. Only CACHE_ENABLED changes. That is why the HPA is paused: if replicas also changed, you couldn't tell which change helped.
  • Why constant arrival rate: k6 sends 50 requests/s whether responses are fast or slow. A slow service then shows up as latency or dropped iterations, not as fewer requests.
  • Use Stage 6 while it runs: in Prometheus, sum(rate(http_requests_total{service="flight",path="/api/flights"}[1m])) shows the load search puts on flight. With the cache off it matches search's rate.
  • A failed threshold is a result: if the baseline misses p(95)<200, k6 exits non-zero. That is data, not a broken lab.

Step 4: Turn the cache on, and prove it three ways​

kubectl set env deploy/search -n $NS CACHE_ENABLED=true
kubectl rollout status deploy/search -n $NS
BASE_URL=http://localhost:18083 EXPECT_CACHE=on \
k6 run --summary-export optimized-summary.json stages/stage7/k6/search.js
jq '.metrics | {p95: .http_req_duration["p(95)"], failed: .http_req_failed.value, hit_rate: .cache_hit_rate.value, dropped: .dropped_iterations.count}' \
baseline-summary.json optimized-summary.json

Then look at one key directly:

D=$(date -u +%F); URL="http://localhost:8083/api/search?origin=BOM&destination=SIN&date=$D"
kubectl exec -n $NS redis-0 -- redis-cli del "search:BOM:SIN:$D"
kubectl exec -n $NS deploy/search -- sh -c "wget -S -O /dev/null '$URL' 2>&1 | grep -i x-cache" # MISS
kubectl exec -n $NS deploy/search -- sh -c "wget -S -O /dev/null '$URL' 2>&1 | grep -i x-cache" # HIT
kubectl exec -n $NS redis-0 -- redis-cli ttl "search:BOM:SIN:$D" # <= 300, counting down
kubectl exec -n $NS deploy/search -- wget -qO- http://127.0.0.1:8083/metrics | grep '^cache_'
  • The three proofs: the header says which code path ran; the counters say how often; the Redis key says what is stored and for how long. The header alone could be wrong; the three together can't all be.
  • What to expect: hit rate 0 with the cache off, above 0.9 with it on. Flight's request rate in Prometheus drops sharply. Whether p95 improves on a laptop with six routes is an observation, not a given. Record what you measured.
  • Why the hit rate is so high here: six routes repeat. Each (origin, destination, date) is its own key, so real traffic spread over many routes and dates gets a lower hit rate.
  • Restore before moving on: exit the k6 README's terminal to trigger its restore, or run bash stages/stage7/scripts/apply.sh --env dev --skip-build. Check kubectl get hpa search-hpa -n $NS is back.

What the cache costs, so you know it when you see it:

  • Stale answers: book a seat on a cached flight and, for up to 300 s, search still shows the old seat count with X-Cache: HIT. Flight shows the new count. redis-cli del on the key, or waiting for the TTL, fixes it.
  • Redis down: kubectl scale sts/redis -n $NS --replicas=0 and search keeps answering 200, all misses. Its readiness endpoint reports the cache but stays ready: kubectl exec -n $NS deploy/search -- wget -qO- http://127.0.0.1:8083/healthz/ready returns {"cache":"unreachable","status":"ready"}. Flight takes the full load again. Notification also uses Redis, so scale it back to 1 right away. Search reconnects by itself.
  • Compared with Stage 4: readiness there meant "my required dependencies work". Here the cache is optional, so readiness reports it but doesn't fail on it. Pulling search out of the Service because Redis is down would turn a slowdown into an outage.

Step 5: Read the HPA, and why it needs Stages 4 and 6​

An HPA (HorizontalPodAutoscaler) is a controller that changes a Deployment's replica count to keep a metric near a target. search-hpa.yaml:

kind: HorizontalPodAutoscaler
spec:
scaleTargetRef: {kind: Deployment, name: search}
minReplicas: 2 # values-dev.yaml: 1
maxReplicas: 10 # values-dev.yaml: 3
metrics:
- type: Resource
resource:
name: cpu
target: {type: Utilization, averageUtilization: 70} # % of the CPU *request*
behavior:
scaleUp:
stabilizationWindowSeconds: 0 # react at once
policies: [{type: Percent, value: 100, periodSeconds: 30}, {type: Pods, value: 4, periodSeconds: 30}]
selectPolicy: Max # whichever adds more
scaleDown:
stabilizationWindowSeconds: 300 # wait 5 min of lower load before removing Pods
policies: [{type: Percent, value: 50, periodSeconds: 60}]
kubectl describe hpa search-hpa -n $NS | sed -n '/Metrics:/,/Events:/p'
kubectl get deploy search -n $NS -o jsonpath='{.spec.template.spec.containers[0].resources}{"\n"}'
  • The formula: desired = ceil(current replicas × current utilisation ÷ target). Two Pods at 140% against 70% → ceil(2 × 140 / 70) = 4, then capped at maxReplicas (3 in dev).
  • Why it needs Stage 4: utilisation is usage ÷ request. Search requests 100m CPU (requests = limits, Guaranteed QoS), so 70% means 70m per Pod. Without a CPU request there is no denominator. The HPA shows <unknown>/70% and does nothing.
  • Why it needs Stage 4's probes too: new replicas get traffic only once their readiness probe passes. Without that, scaling out would send requests to Pods still starting.
  • Why it comes after Stage 6: you can't tune a target you can't see. The Stage 6 dashboards show whether more replicas actually lowered latency, or whether the bottleneck is elsewhere (flight, the database).
  • Why scale up fast and down slow: a spike hurts passengers now; extra Pods for five minutes only cost a little. Removing Pods on every dip would cause churn.
  • Compared with Stage 5: apps.search.replicas in values is now just the starting point. The HPA owns the replica count at runtime. The chart still renders replicas on search's Deployment, so helm upgrade resets it until the HPA raises it again. The Argo CD Applications ignore search's /spec/replicas in dev and staging (with RespectIgnoreDifferences=true), and every Deployment's in prod, so self-heal leaves the HPA alone. See who owns spec.replicas.
  • Why scale-up is a staircase: search's limit equals its request, so throttling caps measured utilization at 100%. Against 70%, each HPA step can multiply replicas by at most about 1.43: 1 → 2 → 3 → 5.

Step 6: Watch it scale under real load, and where the new Pods land​

# terminal 2
watch -n3 "kubectl get hpa search-hpa -n apollo-airlines-apps; kubectl get pods -n apollo-airlines-apps -l app=search -o wide"
# terminal 1
bash stages/stage7/scripts/scaling-lab.sh run

scaling-lab.sh does, in order:

  1. Labels one worker apollo11.io/search-pool=dedicated and taints it workload=search:NoSchedule, then recreates the search Pods.
  2. Lowers the HPA target to 10% and the scale-down window to 30 s, so a laptop can show it quickly. It records the originals first.
  3. Starts a search-load Deployment: four Pods making real HTTP searches. No faked CPU.
  4. Waits for replicas to rise above minReplicas, and checks they span at least two workers.
  5. Deletes the load and waits for scale-in back to minReplicas.
  6. On exit, even after a failure, restores the HPA and removes the label, taint and load. If it was killed: bash stages/stage7/scripts/scaling-lab.sh cleanup.

The search scheduling rules, from values.yaml:

tolerations: # permission to run on the tainted node, not an instruction to
- {key: workload, operator: Equal, value: search, effect: NoSchedule}
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution: # soft: raises the node's score
- weight: 100
preference: {matchExpressions: [{key: apollo11.io/search-pool, operator: In, values: [dedicated]}]}
topologySpreadConstraints: # Stage 7 strengthens Stage 4's soft spread
- {maxSkew: 1, topologyKey: kubernetes.io/hostname, whenUnsatisfiable: DoNotSchedule, nodeTaintsPolicy: Honor}
  • What you see: TARGETS climbs above 10%, REPLICAS goes 1 → 3, the new Pods land on both workers, then it drops back to 1.
  • Why both workers: the taint keeps other workloads off the dedicated node. The toleration only allows search there. Preferred affinity makes that node score higher, and topology spread pushes replicas apart. Affinity remains a preference, but the spread is now a hard constraint. Search can remain Pending when eligible placement would exceed maxSkew: 1; inspect events rather than assuming spare capacity is usable.
  • Why this placement matters only now: with a fixed replica count, placement was decided once. With an HPA, the scheduler places new Pods during every spike.
  • Watch out: the HPA changes a number, it doesn't create capacity. If nodes are full, extra Pods stay Pending with Insufficient cpu, as in Stage 4.
  • Priority: search and booking run as apollo-airlines-app-critical, notification as apollo-airlines-app-low. When a scale-out has no room left, the scheduler can evict low-priority Pods to make room for critical ones.

Step 7: VPA: advice on requests, not action​

A VPA (VerticalPodAutoscaler) watches a workload's real CPU and memory use and recommends requests. Dev turns it off, so render it for staging:

C=stages/stage7/helm/apollo11
helm template apollo11 $C -f $C/values-staging.yaml --show-only templates/autoscaling/search-vpa.yaml
# search-vpa.yaml
kind: VerticalPodAutoscaler
spec:
targetRef: {kind: Deployment, name: search}
updatePolicy:
updateMode: "Off" # recommend only; never change running Pods
resourcePolicy:
containerPolicies:
- containerName: search
minAllowed: {cpu: 50m, memory: 64Mi}
maxAllowed: {cpu: 1, memory: 512Mi}
controlledResources: ["cpu", "memory"]
  • Where the advice appears (staging/prod): kubectl describe vpa search-vpa -n apollo-airlines-apps → Recommendation with Target, Lower Bound, Upper Bound. It stays empty until the recommender has collected samples.
  • Why Off: the HPA scales on usage ÷ request. If the VPA also changed the request, every change would move the HPA's ratio, the HPA would add or remove Pods, which changes per-Pod usage, and the two controllers would chase each other.
  • How advice is used: a person reads the recommendation and edits the resources in values.yaml, then rolls it out through Helm or Argo CD (Stage 5). The change stays reviewed and in Git. Search shares the default tier with flight, so changing tiers.default (as the template comment suggests) resizes flight too; give search its own tier first.
  • Why no admission webhook: in Off mode the VPA never changes Pods, so the bundle installs only the recommender and updater.
  • Why off in dev: its controllers cost resources, and a short-lived local cluster has too little history for useful advice.
  • Compared with Stage 4: the 100m / 128Mi tiers were chosen by reasoning. The VPA is the first thing in the course that checks them against real usage.

Inherited alert delivery and correlation​

Stage 7 carries the Stage 6 Alertmanager, local webhook receiver, Blackbox Exporter and Grafana correlation configuration. On the installed Stage 7 snapshot run:

bash stages/stage7/scripts/observability-lab.sh
bash stages/stage7/scripts/trace-test.sh

See alert delivery and trusted edge probes for manual inspection. Use Stage 7 paths throughout; do not apply another stage's chart to the running release.

Normal-policy capacity and cache correctness​

The cache benchmark fixes one replica to isolate cache impact. Capacity is a separate run through the Gateway, preserving the HPA's normal 70% target and stabilization windows. From the Apollo11 root, with trusted TLS and host name resolution (see Local Gateway and browser access for /etc/hosts setup; on Docker Desktop without host-to-MetalLB routing, see the port-forward or containerized test route):

export KUBE_CONTEXT=kind-apollo11
kubectl --context "$KUBE_CONTEXT" -n apollo-airlines-apps get secret apollo-edge-tls \
-o jsonpath='{.data.tls\.crt}' | base64 -d > /tmp/apollo-capacity.crt
SSL_CERT_FILE=/tmp/apollo-capacity.crt BASE_URL=https://search.apollo.local \
k6 run --summary-export capacity.json stages/stage7/k6/capacity.js

capacity.js sends Host: search.apollo.local (override with HOST_HEADER), so the Gateway routes the request even when BASE_URL names an address rather than the hostname. With HTTPS, TLS still checks the name in BASE_URL.

Watch kubectl get hpa,pods -n apollo-airlines-apps -w in another terminal. The 14-minute profile ramps 10→50→100→200 requests/s and returns to 10. Record p95, failures, dropped iterations, Pod CPU, desired/current replicas and Pending Pods. The October rerun scaled 1→2→3 with 2+1 worker placement and no Pending samples, but dropped iterations failed a threshold: do not call it an all-pass.

Search now uses hard DoNotSchedule spread. nodeTaintsPolicy: Honor excludes the untolerated control-plane taint from spread domains; otherwise the third replica can remain Pending despite free worker capacity. Booking's earlier soft-spread example remains unchanged.

For Redis outage/recovery, stale seat counts, concurrent misses, and the required staging VPA recommendation exercise, follow the pinned PERFORMANCE.md. Dev skips VPA. Tear dev down before installing staging; require nonempty lower, target and upper recommendations while update mode stays Off. These staging steps last ran live on 2026-08-25, before the October image upgrades (tracker G1e).

The Search handler tests use simulated Redis and HTTP upstreams:

(cd stages/stage7/code/search && go test -race ./...)

They cover MISS/HIT, expiry, stale values, concurrent cold misses, upstream and Redis errors, and recovery, plus an invalid date (400), a custom CACHE_TTL_SECONDS, and request_id in the JSON log line. Multiple cold requests may reach Flight: there is no distributed request coalescing guarantee.

When something looks wrong​

You seeLikely causeFirst command
HPA TARGETS <unknown>/70%, ScalingActive=False, FailedGetResourceMetricNo CPU request on the Pods, or metrics-server not readykubectl describe hpa search-hpa -n apollo-airlines-apps; kubectl top pods -n apollo-airlines-apps
kubectl top failsmetrics-server missing or not readykubectl get deploy metrics-server -n kube-system
HPA wants more replicas, Pods PendingNodes are fullkubectl describe pod <pending-pod> → Events
Replicas don't drop after load stopsScale-down window is 300 s by designWait; kubectl get hpa -w
Always X-Cache: MISSCACHE_ENABLED=false left over, or Redis unreachablekubectl exec -n apollo-airlines-apps deploy/search -- wget -qO- http://127.0.0.1:8083/healthz/ready
Search shows old seat countsCached answer within its 300 s TTLkubectl exec -n apollo-airlines-apps redis-0 -- redis-cli ttl search:<from>:<to>:<date>
k6 setup: no seeded resultsSEARCH_DATE outside the seeded rangeSet SEARCH_DATE to a date within the next 30 days
kubectl get vpa finds nothingDev disables VPAUse values-staging.yaml, or render with helm template
search-load or a workload=search taint left behindscaling-lab.sh was killedbash stages/stage7/scripts/scaling-lab.sh cleanup

The troubleshooting page has more.

What this stage does not solve yet​

Limitation you can see nowWhy it hurtsFixed in
The HPA can add Pods, not nodesA big spike ends with Pending PodsStage 9 (planned): Lunar Orbit, Cluster Autoscaler on EKS
Only search autoscales, and only on CPUWork driven by queues or events doesn't show up as CPUStage 11 (planned): KEDA track
Search results can be up to 5 minutes staleA sold-out flight may still show seats in searchA deliberate trade-off; booking checks flight directly
VPA advice must be applied by hand, and dev has noneRequests drift from reality unless someone reads it— (by design in Off mode)
The chart sets search's replicas while the HPA manages ithelm upgrade resets the count until the HPA corrects it (Argo CD ignores the field)Omit replicas when autoscaling is on
Search's cache key uses raw query values, and its Redis also holds notification's queue, with persistence onKeys grow with distinct inputs; no safe eviction policy can cap memoryA normalized key and a separate cache instance (Cache-aside)
Secrets are base64 in Git, no RBAC, NetworkPolicies not enforced, Grafana openThis deployment is not hardened. Do not describe it as suchStage 8 (planned): Command Module (security)
No view of what all these replicas costScaling decisions are made without cost dataStage 11 (planned): Kubecost track
Everything still runs on a local kind clusterNo real load balancer, disks or node failuresStage 9 (planned): Lunar Orbit (AWS lifecycle)

The journey so far​

ConcernLaunchpadIgnitionStage 1Stage 2Stage 3Stage 4Stage 5Stage 6Stage 7
Runs onOne Docker host3-node kindSameSameSameSameSameSameSame
Unit of deploymentCompose serviceBare PodDeploymentDeployment+ StatefulSetSameHelm release+ observabilitySame
Recoveryrestart:NoneReplicaSetSameSame+ probes restart / drain+ Argo CD self-healSameSame
Service discoveryDocker DNSPod IPService + DNS+ cross-namespace DNS+ headless ServicesSameSame+ ServiceMonitorsSame
Entry pointports:port-forwardNodePortDNS → NodePort → Traefik + TLS → MetalLB → Envoy Gateway APIEnvoy GatewaySameSame+ grafana.apollo.localSame
Config / secretsenvironment:InlineConfigMap / SecretSameSameSameRendered from values+ observability:+ autoscaling:, vpa:, redis.cache
DataNamed volume—emptyDiremptyDirPVCsSameSame+ telemetry PVCs+ Redis as search cache
Health checksCompose healthcheckNoneLiveness + readinessSameSameStartup / liveness / readinessSame+ SLO and alertsSearch readiness reports cache state
ResourcesNoneNoneNoneNoneNoneRequests = limits, PDBsPer-env valuesSame+ VPA advice (staging/prod)
How it's deployeddocker compose upkubectl applyapply.shSameSameSameHelm / Kustomize / Argo CD+ signals-lab.sh+ metrics-server, k6, scaling-lab.sh
Observabilitydocker logskubectl logskubectl logsSameSameSameSameMetrics, dashboards, SLO, logs, traces+ cache counters and spans
ScalingFixed—Fixed (2)FixedFixedFixedFixed per envFixed per envHPA on search (dev 1–3, default 2–10, prod 3–20)

Clean up​

pkill -f 'port-forward' || true
kubectl get hpa,deploy -n apollo-airlines-apps # HPA present, no search-load
bash stages/stage7/scripts/verify.sh --mode helm --env dev # optional: the full automated check
bash stages/stage7/scripts/teardown.sh --purge
kubectl get ns | grep apollo # nothing

--purge also removes metrics-server, the VPA controllers (if installed), the access stack and related CRDs.

You should now be able to explain​

  • Why we measured search with the cache off before turning it on, and why the HPA had to be paused for that.
  • How cache-aside works, what the 300 s TTL trades away, and why booking never reads the cache.
  • Why a Redis outage makes search slower but leaves it Ready.
  • Why the HPA cannot scale on CPU without Stage 4's requests, and what <unknown> means.
  • How to work out the HPA's next replica count, and why scale-down waits five minutes.
  • The difference between a taint, a toleration, preferred affinity and topology spread.
  • Why the VPA runs in Off mode next to a CPU-based HPA.

Next: this completes the supported local path. The Capstone puts Stages 1–7 together; Stage 8: Command Module (planned) is where security hardening begins.