Appendix B: Final exam
Goal: You solve ten tasks spanning the whole course in 120 minutes: find and fix faults in the running cluster, plan a switchover under load, measure and calculate. Each task with cause and proof, then you grade yourself · Duration: 120 min · Prerequisite: Days 0–15
Rules of the game
- Time: 120 minutes, set a clock. Each task counts 10%. The target times add up to 110 minutes; the rest is buffer.
- There is no certificate. Your own bar: from 70% on, you can design, operate and justify a system on Kubernetes.
- An examiner (a colleague, or you yourself without looking) runs the task’s preparation in a second terminal before each task, if it has one. The task only describes the symptom or the assignment.
- Allowed:
--help, the official documentation of Kubernetes, Envoy Gateway, CloudNativePG, Valkey, NATS, KEDA, Linkerd and k6, and your files under~/sdk. Not allowed: this course during the exam. - A task only counts with the cause in one sentence and a proof command. Anyone who switches off a building block instead of repairing it (deleting the rate limit, removing KEDA, deleting the PDB, switching off the cache) gets 0%.
- All commands run on s1,
KUBECONFIGis set. - The solutions are at the end. Read them only after time is up.
Preparation
Once before the first task, in the terminal you work in:
# on s1
# Working directory for the exam
mkdir -p ~/sdk/pruefung && cd ~/sdk/pruefung
# kubeconfig for this shell
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# Load scripts and codes from Days 10, 11 and 14
cp ../tag14/mix.js ../tag14/codes.txt ../tag11/status.js ../tag10/klick.js .
# NATS CLI with address and credentials
N="nats -s nats://kurz:lab-nats-123@$(kubectl -n nats get svc nats -o jsonpath='{.spec.clusterIP}'):4222"
# Function messen: mix of redirects and creates, rate and duration selectable (as on Day 15)
messen() { k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=${1:-400} -e DAUER=${2:-20s} mix.js 2>&1 \
| grep -E 'http_req_duration\.|http_req_failed\.|http_reqs\.' | sed 's/ */ /g'; }
# Function st: count and p95 per status code, passes further k6 options through (as on Day 15)
st() { k6 run -q -e ZIEL=http://172.16.0.126 -e DAUER=20s "$@" status.js 2>&1 \
| grep -A1 -E '\{status:(302|429|503)\}' | sed 's/ */ /g' | grep -v '^--' | paste - - | grep -v 'count=0\|p(95)=0s' | awk '{print $1, $NF}'; }
# Baseline
messenExpected:
http_req_duration..............: avg=16.08ms min=3.16ms med=11.83ms max=142.54ms p(90)=30.25ms p(95)=42.75ms
http_req_failed................: 0.00% 0 out of 8000
http_reqs......................: 8000 399.751598/s
Task 1: The entrance is closed (10%)
Examiner:
# on s1
kubectl -n kurz patch httproute kurz --type json -p '[{"op":"replace","path":"/spec/rules/0/backendRefs/0/port","value":8080}]' >/dev/null
clearEvery request through the Gateway (http://172.16.0.126)
fails immediately with 500. The kurz pods are running and
ready. Bring the entrance back and prove it. Target
time: 6 min
Task 2: The cache that holds nothing anymore (10%)
Examiner:
# on s1
kubectl -n kurz patch valkeycluster cache --type merge -p '{"spec":{"config":{"maxmemory":"1mb"}}}' >/dev/null
clearSince a change to the cache, almost all requests fail at 800
redirects per second (klick.js). At 300 per second, nobody
notices anything. Find the cause, repair it and prove that 800 per
second run without errors again. Target time: 12
min
Task 3: Maintenance on s3 (10%)
Examiner:
# on s1
kubectl -n kurz patch pdb kurz --type merge -p '{"spec":{"minAvailable":3}}' >/dev/null
clears3 gets a kernel update. Drain its kurz pod from the
node while 300 requests per second are running, with:
# on s1
# Evict only the kurz pods from s3, wait at most 30 s
kubectl drain s3 --ignore-daemonsets --delete-emptydir-data --pod-selector=app=kurz --timeout=30sThe drain does not get through. Get it through without errors for the
users, release s3 again and make sure that afterwards a
kurz pod runs in every zone again. Target
time: 10 min
Task 4: Moving the primary (10%)
No preparation. s1 gets maintenance tomorrow, and the primary
db-1 lives there. Move it to db-2 beforehand
while 800 requests per second are running (mix.js, 10%
creates). Say with numbers which requests fail, how many, and why there
are clearly more of them than the switchover itself takes.
Target time: 15 min
Task 5: Clicks into the void (10%)
Examiner:
# on s1
B=$($N stream info KLICKS --json | jq .state.bytes)
kubectl -n kurz patch streams.jetstream.nats.io klicks --type merge -p "{\"spec\":{\"discard\":\"new\",\"maxBytes\":$((B + 1000000))}}" >/dev/null
sleep 10
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=1000 -e DAUER=30s klick.js >/dev/null 2>&1
clearThe click counts in the database no longer rise. zaehler
has no backlog, users see no errors, kurz reports nothing.
Find the cause, repair it and prove that every click is counted again.
Target time: 12 min
Task 6: Counted slowly (10%)
Examiner:
# on s1
kubectl -n kurz patch scaledobject zaehler --type json -p '[{"op":"replace","path":"/spec/triggers/0/metadata/lagThreshold","value":"50000"}]' >/dev/null
clearAfter a spike of 1000 clicks per second for 30 seconds, it takes minutes until all of them are counted. The backlog used to be gone after one minute. Find the cause, repair it and measure how the backlog drains. Target time: 12 min
Task 7: The autoscaler is blind (10%)
Examiner:
# on s1
kubectl -n kurz patch deploy kurz --type json -p '[{"op":"remove","path":"/spec/template/metadata/annotations/config.linkerd.io~1proxy-cpu-request"}]' >/dev/null
kubectl -n kurz rollout status deploy kurz >/dev/null
clearSince the last rollout, the autoscaler of kurz no longer
shows CPU utilization, and during load spikes it stays at three pods.
Find the cause and prove that the autoscaler calculates again.
Target time: 10 min
Task 8: The limit that does not bite (10%)
Examiner:
# on s1
kubectl -n envoy-gateway-system scale deploy ratelimit-valkey --replicas=0 >/dev/null
clearA customer who identifies with X-Nutzer sends 100
requests per second. 50 are allowed, but they no longer get a single
429, and their redirects have become slower. Nobody changed
anything in the policy. Target time: 10 min
Task 9: 404 in the mesh (10%)
Examiner:
# on s1
kubectl -n kurz patch httproute kurz-mesh --type json -p '[{"op":"replace","path":"/spec/rules/0/matches/0/path/value","value":"/api/"}]' >/dev/null
clearThe load generator in the mesh (Deployment last, Day 12)
gets a 404 for every request to
http://kurz.kurz.svc.cluster.local. Through the Gateway,
everything works, and kurz does not log a single error.
Target time: 8 min
Task 10: How many at once? (10%)
No preparation. At 800 per second (mix.js), how many
requests are on their way between the Envoys and kurz at
the same time, on average? Predict it with Little’s Law from the k6
output, verify it at the Envoys’ admin interface (port 19000) and
explain the difference. What does that mean for the circuit breaker from
Day 11? Target time: 15 min
Solutions
Solution 1
# on s1
# Error rate through the Gateway
messen 200 10s
# Look at Envoy's response
C=$(head -1 codes.txt)
curl -s -i http://172.16.0.126/$C | head -5
# The same code directly via the ClusterIP of kurz
curl -s -o /dev/null -w "%{http_code}\n" http://$(kubectl -n kurz get svc kurz -o jsonpath='{.spec.clusterIP}')/$C
# State of the route with reason and message
kubectl -n kurz get httproute kurz -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'
# Ports of the Service and target of the route
kubectl -n kurz get svc kurz -o jsonpath='{.spec.ports}{"\n"}'
kubectl -n kurz get httproute kurz -o jsonpath='{.spec.rules[0].backendRefs}{"\n"}'Expected:
http_req_duration....: avg=2.16ms min=1ms med=1.9ms max=10.91ms p(90)=3.07ms p(95)=4.05ms
http_req_failed......: 100.00% 2001 out of 2001
http_reqs............: 2001 200.026977/s
HTTP/1.1 500 Internal Server Error
date: Wed, 25 Nov 2026 23:14:52 GMT
content-length: 0
302
Accepted=True Accepted: Route is accepted
ResolvedRefs=False PortNotFound: Failed to process route rule 0 backendRef 0: TCP Port 8080 not found on Service kurz/kurz.
[{"name":"http","port":80,"protocol":"TCP","targetPort":"http"}]
[{"group":"","kind":"Service","name":"kurz","port":8080,"weight":1}]
Cause: The route points to port 8080 of the Service
kurz, which only has port 80. Envoy Gateway accepts the
route (Accepted=True) but finds no target
(ResolvedRefs=False) and answers every request itself with
500, fast and without a body (Day 3). kurz
directly delivers 302. Port 8080 is the container’s port,
not the Service’s.
# on s1
# What would the file from Day 3 change?
kubectl diff -f ../tag03/gateway.yaml | grep -E '^[-+] ' | grep -v generation
# Apply, give Envoy a moment
kubectl apply -f ../tag03/gateway.yaml
sleep 10
# Route fully resolved, measurement
kubectl -n kurz get httproute kurz -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {end}{"\n"}'
messen 200 10sExpected:
- port: 8080
+ port: 80
gatewayclass.gateway.networking.k8s.io/eg unchanged
gateway.gateway.networking.k8s.io/web configured
httproute.gateway.networking.k8s.io/kurz configured
Accepted=True ResolvedRefs=True
http_req_duration..............: avg=9.17ms min=3.59ms med=8.05ms max=47.46ms p(90)=14ms p(95)=16.85ms
http_req_failed................: 0.00% 0 out of 2000
http_reqs......................: 2000 199.747249/s
The fast errors (p95 4 ms) were the first clue: no backend answers
that fast. A 500 without a body comes from the Gateway.
Solution 2
# on s1
# Function xact: transactions of the database kurz, summed over all three instances
xact() { for p in db-1 db-2 db-3; do kubectl -n kurz exec $p -c postgres -- psql -d kurz -tAc "select xact_commit from pg_stat_database where datname = 'kurz'"; done | awk '{s += $1} END {print s}'; }
# valkey-cli in the pod, as on Day 5
V="kubectl -n kurz exec valkey-cache-1-0-0 -c server -- valkey-cli -a lab-valkey-123 --no-auth-warning"
# 20 s at 800/s, transactions per second
X0=$(xact); k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=20s klick.js 2>&1 | grep -E 'http_req_duration\.|http_req_failed\.' | sed 's/ */ /g'; X1=$(xact); echo "DB-Transaktionen: $(( (X1 - X0) / 20 ))/s"Expected:
http_req_duration..............: avg=325.07ms min=650.84µs med=115.79ms max=2.6s p(90)=985.03ms p(95)=1.07s
http_req_failed................: 97.33% 14772 out of 15176
DB-Transaktionen: 80/s
Before the fault, the same measurement showed 0% errors, p95 124 ms
and 21 transactions per second (DB-Transaktionen = DB
transactions). What does the cache say?
# on s1
# Reset statistics, 10 s of load, hits and misses across all nodes
$V --cluster call 127.0.0.1:6379 CONFIG RESETSTAT >/dev/null
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=10s klick.js >/dev/null 2>&1
$V --cluster call 127.0.0.1:6379 INFO stats | grep -E 'keyspace_(hits|misses)|evicted_keys' | tr -d '\r' | awk -F: '{s[$1]+=$2} END {print "hits", s["keyspace_hits"], "misses", s["keyspace_misses"], "evicted", s["evicted_keys"]}'
# Memory and limit of the first node
$V --cluster call 127.0.0.1:6379 INFO memory | grep -E '^(used_memory_human|maxmemory_human):' | tr -d '\r' | head -2
# Configuration in the operator's resource
kubectl -n kurz get valkeycluster cache -o jsonpath='{.spec.config}{"\n"}'
# Load by status once more, then count the log lines of kurz
st -e RATE=800 -e DAUER=10s
kubectl -n kurz logs -l app=kurz -c kurz --since=30s --tail=-1 | cut -c21- | sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+/ADDR/g; s/kurz-[a-z0-9]+-[a-z0-9]+: //; s/link:[A-Za-z0-9]+/link:CODE/' | sort | uniq -c | sort -rn | head -5Expected:
hits 0 misses 6260 evicted 0
used_memory_human:3.39M
maxmemory_human:1.00M
{"maxmemory":"1mb","maxmemory-policy":"allkeys-lru"}
http_req_duration{status:302} p(95)=827.83ms
http_req_duration{status:503} p(95)=767.64ms
http_reqs{status:302} count=1066
http_reqs{status:503} count=5329
6559 weiterleiten: context canceled
1203 cache set: OOM command not allowed when used memory > 'maxmemory'.
54 cache get: context canceled
6 weiterleiten: timeout: context already done: context canceled
3 weiterleiten: failed to deallocate cached statement(s): context canceled
Cause: maxmemory is set to 1 MB, but
each Valkey node already needs 3.4 MB without any data. Every
SET fails with OOM, no key stays, zero hits
(as on Day 5). Every redirect goes to the database. At 800 per second
the requests pile up, Envoy aborts attempts after the 300 ms deadline
that the Gateway has set since Day 12 (context canceled in
the log of kurz; weiterleiten = redirect), and
the client mostly receives 503.
# on s1
# Apply the manifest from Day 5 again (maxmemory 64mb)
kubectl apply -f ../tag05/cache.yaml
# Wait briefly, then: do all six nodes have 64 MB?
sleep 15
$V --cluster call 127.0.0.1:6379 CONFIG GET maxmemory | grep -c 67108864
# Reset statistics and the same measurement as above
$V --cluster call 127.0.0.1:6379 CONFIG RESETSTAT >/dev/null
X0=$(xact); k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=20s klick.js 2>&1 | grep -E 'http_req_duration\.|http_req_failed\.' | sed 's/ */ /g'; X1=$(xact); echo "DB-Transaktionen: $(( (X1 - X0) / 20 ))/s"
$V --cluster call 127.0.0.1:6379 INFO stats | grep -E 'keyspace_(hits|misses)|evicted_keys' | tr -d '\r' | awk -F: '{s[$1]+=$2} END {print "hits", s["keyspace_hits"], "misses", s["keyspace_misses"], "evicted", s["evicted_keys"]}'Expected:
valkeycluster.valkey.io/cache configured
6
http_req_duration..............: avg=276.59ms min=742.96µs med=60.83ms max=1.3s p(90)=960.72ms p(95)=999.13ms
http_req_failed................: 65.38% 9979 out of 15261
DB-Transaktionen: 62/s
hits 4800 misses 11997 evicted 0
Repaired, and still 65% errors. This is the real test of this task.
The cache is empty, and under full load it does not fill up:
kurz writes an entry only after the database has answered,
and exactly these requests are aborted by Envoy after 300 ms, before the
SET happens. A second run still showed 38.9%. The system
stays in its bad state even though the cause is gone. The way out: warm
the cache with little load, then measure again.
# on s1
# 20 s at 200/s fill the cache
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=200 -e DAUER=20s klick.js 2>&1 | grep -E 'http_req_failed\.' | sed 's/ */ /g'
# Keys across all nodes (primaries and replicas)
$V --cluster call 127.0.0.1:6379 DBSIZE | tail -6 | awk '{s+=$2} END {print "Schlüssel:", s}'
# 800/s again
$V --cluster call 127.0.0.1:6379 CONFIG RESETSTAT >/dev/null
X0=$(xact); k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=20s klick.js 2>&1 | grep -E 'http_req_duration\.|http_req_failed\.' | sed 's/ */ /g'; X1=$(xact); echo "DB-Transaktionen: $(( (X1 - X0) / 20 ))/s"
$V --cluster call 127.0.0.1:6379 INFO stats | grep -E 'keyspace_(hits|misses)|evicted_keys' | tr -d '\r' | awk -F: '{s[$1]+=$2} END {print "hits", s["keyspace_hits"], "misses", s["keyspace_misses"], "evicted", s["evicted_keys"]}'Expected:
http_req_failed................: 0.00% 0 out of 4000
Schlüssel: 2000
http_req_duration..............: avg=31.32ms min=2.68ms med=20.68ms max=238.98ms p(90)=67.54ms p(95)=94.12ms
http_req_failed................: 0.00% 0 out of 15862
DB-Transaktionen: 13/s
hits 15862 misses 0 evicted 0
The 2000 keys (Schlüssel) are the 1000 codes from
codes.txt, once each on primary and replica. Every hit
saves a trip to the database. Anyone who measures only once after the
repair and sees 65% keeps searching in the wrong place. After a cache
outage, warming belongs in the runbook, just like after a restart of the
whole cluster.
Solution 3
# on s1
# Output of the failed drain, identical lines counted
kubectl drain s3 --ignore-daemonsets --delete-emptydir-data --pod-selector=app=kurz --timeout=30s 2>&1 | grep -v '^WARNING' | sort | uniq -c | sort -rn | head -5
# PDBs with minimum and allowed disruptions
kubectl get pdb -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,MIN:.spec.minAvailable,ERLAUBT:.status.disruptionsAllowed
# How many kurz pods are ready?
kubectl -n kurz get deploy kurz -o jsonpath='{.status.readyReplicas}{"\n"}'Expected:
7 evicting pod kurz/kurz-7cb74dbd79-frsbh
6 error when evicting pods/"kurz-7cb74dbd79-frsbh" -n "kurz" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
1 pod/kurz-7cb74dbd79-frsbh
1 node/s3 cordoned
1 error: unable to drain node "s3" due to error: error when evicting pods/"kurz-7cb74dbd79-frsbh" -n "kurz": global timeout reached: 30s, continuing command...
NS NAME MIN ERLAUBT
kurz db 1 1
kurz db-primary 1 0
kurz kurz 3 0
kurz valkey-cache <none> 1
nats nats <none> 1
3
Cause: The PDB of kurz demands three
available pods, and exactly three are running. So it allows not a single
eviction (ERLAUBT = allowed), and a drain waits forever
(Day 13). A PDB with minAvailable equal to the pod count is
a maintenance ban. The file from Day 13 says two:
# on s1
# Apply the PDB from Day 13 again (minAvailable 2)
kubectl apply -f ../tag13/pdb-kurz.yaml
# 60 s of load in the background, drain again after 10 s
(k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=300 -e DAUER=60s mix.js > k6-drain.txt 2>&1 &)
sleep 10
kubectl drain s3 --ignore-daemonsets --delete-emptydir-data --pod-selector=app=kurz --timeout=60s 2>&1 | grep -v '^WARNING'
# Where did the replacement go?
sleep 15
kubectl -n kurz get pods -l app=kurz -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName,READY:.status.containerStatuses[0].ready --no-headers
# Maintenance over: release s3, wait for the end of the load, result
kubectl uncordon s3
sleep 40
grep -E 'http_req_failed\.|http_reqs\.' k6-drain.txt | sed 's/ */ /g'Expected:
poddisruptionbudget.policy/kurz configured
node/s3 already cordoned
evicting pod kurz/kurz-7cb74dbd79-frsbh
pod/kurz-7cb74dbd79-frsbh evicted
node/s3 drained
kurz-7cb74dbd79-6xbj8 s1 true
kurz-7cb74dbd79-qmdlr s1 true
kurz-7cb74dbd79-xt6hg s2 true
node/s3 uncordoned
http_req_failed................: 0.00% 0 out of 18000
http_reqs......................: 18000 299.811091/s
Not a single error. The replacement ran on s1 right away, because
nodeTaintsPolicy: Honor does not count the cordoned node
(Day 13). After the uncordon, two pods remain in
zone-a: Kubernetes does not redistribute running pods. A
rollout takes care of that:
# on s1
# New pods; the hard spreading rule places one per zone
kubectl -n kurz rollout restart deploy kurz
kubectl -n kurz rollout status deploy kurz | tail -1
sleep 20
kubectl -n kurz get pods -l app=kurz -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName --no-headersExpected:
deployment.apps/kurz restarted
deployment "kurz" successfully rolled out
kurz-5cdd845fc4-l755z s3
kurz-5cdd845fc4-ngbrh s1
kurz-5cdd845fc4-pcbd9 s2
By the way, without --delete-emptydir-data the drain
aborts before any PDB comes into play
(cannot delete Pods with local storage): Linkerd attaches
two emptyDir volumes to every pod, and
kubectl drain discards local data only when explicitly
asked to.
Solution 4
Look first, then switch. Without a switchover, a drain of s1 would
get stuck on the PDB db-primary:
# on s1
# PDB of the primary: how many disruptions are allowed?
kubectl get pdb -n kurz db-primary -o custom-columns=NAME:.metadata.name,MIN:.spec.minAvailable,ERLAUBT:.status.disruptionsAllowed
# Current primary, pods with node and role
kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}{"\n"}'
kubectl -n kurz get pods -l cnpg.io/cluster=db -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName,ROLLE:.metadata.labels.cnpg\\.io/instanceRole --no-headersExpected:
NAME MIN ERLAUBT
db-primary 1 0
db-1
db-1 s1 primary
db-2 s2 replica
db-3 s3 replica
db-pooler-rw-77fc8bd78-6nq6k s1 <none>
db-pooler-rw-77fc8bd78-mgpnd s3 <none>
To separate the errors by kind, mix.js gets the same
threshold counters per status code as status.js on Day 11,
split into creates (anlegen) and redirects
(weiterleiten):
# on s1
# mix-status.js: mix.js with counters per name and status instead of the thresholds
sed 's#thresholds: {.*#thresholds: { "http_reqs{name:anlegen,status:201}": ["count>=0"], "http_reqs{name:anlegen,status:200}": ["count>=0"], "http_reqs{name:anlegen,status:503}": ["count>=0"], "http_reqs{name:weiterleiten,status:302}": ["count>=0"], "http_reqs{name:weiterleiten,status:503}": ["count>=0"] },#' mix.js > mix-status.js
# Exactly one line replaced?
grep -c 'name:anlegen' mix-status.js
# Wait for three ready instances
until [ "$(kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances}')" = 3 ]; do sleep 3; done
# 60 s of load, after 10 s the switchover to db-2
(k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=60s mix-status.js > k6-wechsel.txt 2>&1 &)
sleep 10; date -u +%T; kubectl cnpg promote db db-2 -n kurz 2>/dev/null
# Every 5 s: primary and phase
for i in $(seq 8); do printf "%s primary=%s phase=%s\n" $(date -u +%T) $(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}') "$(kubectl -n kurz get cluster db -o jsonpath='{.status.phase}' | tr ' ' _)"; sleep 5; done
# End of the load, error rate and counters per kind
sleep 15
grep -E 'http_req_failed\.' k6-wechsel.txt | sed 's/ */ /g'
grep -A1 'http_reqs{name' k6-wechsel.txt | sed 's/ */ /g' | grep -v '^--' | paste - - | awk '{print $1, $NF}'
# What kurz logged during that time
kubectl -n kurz logs -l app=kurz -c kurz --since=80s --tail=-1 | cut -c21- | sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+/ADDR/g; s/kurz-[a-z0-9]+-[a-z0-9]+: //' | sort | uniq -c | sort -rn | head -6Expected:
1
23:34:36
Node db-2 in cluster db will be promoted
23:34:37 primary=db-1 phase=Switchover_in_progress
23:34:44 primary=db-1 phase=Switchover_in_progress
23:34:52 primary=db-2 phase=Switchover_in_progress
23:34:59 primary=db-2 phase=Switchover_in_progress
23:35:07 primary=db-2 phase=Switchover_in_progress
23:35:14 primary=db-2 phase=Switchover_in_progress
23:35:21 primary=db-2 phase=Switchover_in_progress
23:35:28 primary=db-2 phase=Cluster_in_healthy_state
http_req_failed......................: 7.36% 3469 out of 47100
http_reqs{name:anlegen,status:200} count=1303
http_reqs{name:anlegen,status:201} count=21
http_reqs{name:anlegen,status:503} count=3368
http_reqs{name:weiterleiten,status:302} count=42307
http_reqs{name:weiterleiten,status:503} count=69
184 anlegen: context canceled
35 weiterleiten: context canceled
35 cache get: context canceled
9 Sicherung offen für 5s (8 Fehler in Folge)
9 Sicherung offen für 5s (7 Fehler in Folge)
9 Sicherung offen für 5s (6 Fehler in Folge)
Answer:
- Which: almost only creates. 3368 of 4692 writes failed, 72%. Of 42,376 redirects only 69 failed; they keep running via cache and replicas (Day 6). Overall 7.36%.
- How long the switchover takes: after about 16
seconds
db-2was primary, after just under a minute CNPG reported the cluster healthy. - Why so many: two amplifiers from earlier days. The
circuit breaker in
kurz(from the predecessor course, only on the write path) opens for 5 seconds after a few errors in a row and during that time answers every create immediately with503(Sicherung offen für 5s (8 Fehler in Folge)= circuit breaker open for 5 s, 8 errors in a row). The six lines shown alone stand for 27 such pauses. And Envoy aborts every attempt after 300 ms (Day 12): 184 times this hit a create (anlegen: context canceled). Just over 16 seconds without a primary turn into almost a minute without reliable writes. - What to do about it: put the switchover in a
low-load window, let clients retry with an idempotency key and backoff
(predecessor course, Day 11), and only run
kubectl drain s1after the switchover.
Happened during testing: A first version of this task took away the pooler settings from Day 7 beforehand (
server_login_retry,server_connect_timeout). The switchover then cost 7.95%, with the settings 7.27%, and in another run 3.78%. No measurable difference anymore: on Day 7 it was 5.40 versus 1.79%, but back then there was neither the mesh nor the 300 ms deadline at the Gateway. A finding holds for the state in which it was measured.
The primary stays on db-2 until the end of the exam. The
clean-up brings it back.
Solution 5
# on s1
# Primary and function summe: counted clicks in the database
P=$(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}')
summe() { kubectl -n kurz exec $P -c postgres -- psql -d kurz -tAc 'SELECT sum(anzahl) FROM klicks'; }
# Wait until zaehler has nothing pending, then baseline values
until [ "$($N consumer info KLICKS zaehler --json | jq '.num_pending + .num_ack_pending')" = 0 ]; do sleep 2; done
A=$(summe); S0=$($N stream info KLICKS --json | jq .state.last_seq)
# 20 s at 500 clicks per second
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=500 -e DAUER=20s klick.js 2>&1 | grep -E 'http_reqs\.|http_req_failed\.' | sed 's/ */ /g'
# Let it process, then compare
sleep 5
until [ "$($N consumer info KLICKS zaehler --json | jq '.num_pending + .num_ack_pending')" = 0 ]; do sleep 2; done
S1=$($N stream info KLICKS --json | jq .state.last_seq)
echo "gezählt: $(( $(summe) - A )), neu im Stream: $((S1 - S0))"
# Limits of the stream
$N stream info KLICKS --json | jq -c '{bytes: .state.bytes, max_bytes: .config.max_bytes, discard: .config.discard}'
# Does kurz report lost clicks?
kubectl -n kurz logs -l app=kurz -c kurz --since=1m --tail=-1 | grep -c zaehle
# What is in the NACK resource?
kubectl -n kurz get streams.jetstream.nats.io klicks -o jsonpath='{.spec.discard} {.spec.maxBytes}{"\n"}'Expected:
http_req_failed................: 0.00% 0 out of 9994
http_reqs......................: 9994 499.248802/s
gezählt: 0, neu im Stream: 0
{"bytes":246972439,"max_bytes":246972474,"discard":"new"}
0
new 246972474
Cause: The stream is full (gezählt =
counted, neu im Stream = new in the stream). Someone gave
it a limit in bytes just above the level at the time, with
discard: new: once the limit is reached, JetStream accepts
no new messages. kurz publishes with core NATS, without
confirmation (Day 8), and notices nothing. 9994 redirects, zero
messages, zero errors, zero log lines. The same happens without any
misconfiguration when the 1 GiB volume is full (Day 14).
The obvious repair is a trap:
# on s1
# What would the file from Day 8 change?
kubectl diff -f ../tag08/stream.yaml | grep -E '^[-+] ' | grep -v generationExpected:
+ name: nats-kurz
- discard: new
+ discard: old
apply would only reset discard.
maxBytes is not in the file, so not in
last-applied, and would stay as it is (the same trap as on
Day 2 and Day 15). With discard: old and the limit,
JetStream would from then on delete the oldest message for every new
one. The line name: nats-kurz belongs to the account
resource in the same file and is harmless. Set both fields
explicitly:
# on s1
# Old limits: no byte limit, discard the oldest
kubectl -n kurz patch streams.jetstream.nats.io klicks --type merge -p '{"spec":{"discard":"old","maxBytes":-1}}'
sleep 10
$N stream info KLICKS --json | jq -c '{bytes: .state.bytes, max_bytes: .config.max_bytes, discard: .config.discard}'
# The same measurement as above
until [ "$($N consumer info KLICKS zaehler --json | jq '.num_pending + .num_ack_pending')" = 0 ]; do sleep 2; done
A=$(summe); S0=$($N stream info KLICKS --json | jq .state.last_seq)
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=500 -e DAUER=20s klick.js 2>&1 | grep -E 'http_reqs\.' | sed 's/ */ /g'
sleep 5
until [ "$($N consumer info KLICKS zaehler --json | jq '.num_pending + .num_ack_pending')" = 0 ]; do sleep 2; done
S1=$($N stream info KLICKS --json | jq .state.last_seq)
echo "gezählt: $(( $(summe) - A )), neu im Stream: $((S1 - S0))"Expected:
stream.jetstream.nats.io/klicks patched
{"bytes":246972439,"max_bytes":-1,"discard":"old"}
http_reqs......................: 10000 499.424356/s
gezählt: 10000, neu im Stream: 10000
Every click is back in the stream and in the database. The signal
that would have reported this outage early: state.bytes
relative to the limit, or last_seq standing still despite
traffic.
Solution 6
# on s1
# Function offen: messages that no worker has fetched yet
offen() { $N consumer info KLICKS zaehler --json | jq .num_pending; }
# The spike from the task
k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=1000 -e DAUER=30s klick.js >/dev/null 2>&1
# Every 10 s: backlog and pods
T0=$(date +%s); for i in $(seq 1 6); do echo "$(( $(date +%s) - T0 ))s offen=$(offen) pods=$(kubectl -n kurz get deploy zaehler -o jsonpath='{.status.readyReplicas}/{.spec.replicas}')"; sleep 10; done
# Settings of the trigger
kubectl -n kurz get scaledobject zaehler -o jsonpath='{.spec.triggers[0].metadata}{"\n"}'
# What KEDA's HPA sees: current value and target per pod
kubectl -n kurz get hpa keda-hpa-zaehler -o jsonpath='{.status.currentMetrics[0].external.current.averageValue} {.spec.metrics[0].external.target.averageValue}{"\n"}'Expected:
0s offen=27747 pods=1/1
11s offen=26647 pods=1/1
21s offen=25647 pods=1/1
32s offen=24647 pods=1/1
42s offen=23547 pods=1/1
53s offen=22547 pods=1/1
{"account":"$G","consumer":"zaehler","lagThreshold":"50000","natsServerMonitoringEndpoint":"nats-headless.nats.svc.cluster.local:8222","stream":"KLICKS"}
22247 50k
Cause: lagThreshold is set to 50,000
instead of 500. KEDA calculates ⌈backlog ÷ threshold⌉ pods, so ⌈27,747 ÷
50,000⌉ = 1 (Day 10). One zaehler manages about 100 clicks
per second with batch 100 and a one-second pause, so the backlog
(offen = pending) drops by just over 1000 per 10 seconds.
For 27,747 that would take almost five minutes.
# on s1
# Difference to the file from Day 10, then apply
kubectl diff -f ../tag10/zaehler-scaler-ende.yaml | grep -E '^[-+] ' | grep -v generation
kubectl apply -f ../tag10/zaehler-scaler-ende.yaml
# Watch the backlog drain until nothing is pending
T0=$(date +%s); for i in $(seq 1 12); do o=$(offen); echo "$(( $(date +%s) - T0 ))s offen=$o pods=$(kubectl -n kurz get deploy zaehler -o jsonpath='{.status.readyReplicas}/{.spec.replicas}')"; [ "$o" = 0 ] && break; sleep 10; doneExpected:
- lagThreshold: "50000"
+ lagThreshold: "500"
scaledobject.keda.sh/zaehler configured
0s offen=21147 pods=1/1
11s offen=19147 pods=3/3
21s offen=15947 pods=5/5
32s offen=10847 pods=5/5
43s offen=4247 pods=7/7
53s offen=0 pods=7/7
The brake from Day 10 (at most 2 pods per 15 seconds) is easy to see:
1, 3, 5, 7. After 53 seconds the backlog is gone. Afterwards KEDA scales
zaehler back to zero.
Solution 7
# on s1
# What the HPA sees
kubectl -n kurz get hpa keda-hpa-kurz
# Condition ScalingActive with reason and message
kubectl -n kurz get hpa keda-hpa-kurz -o jsonpath='{.status.conditions[?(@.type=="ScalingActive")].status} {.status.conditions[?(@.type=="ScalingActive")].reason}: {.status.conditions[?(@.type=="ScalingActive")].message}{"\n"}' | cut -c1-200
# Requests of all containers of a kurz pod, including the init containers
P=$(kubectl -n kurz get pods -l app=kurz -o name | head -1)
kubectl -n kurz get $P -o jsonpath='{range .spec.initContainers[*]}{.name} {.resources.requests}{"\n"}{end}{range .spec.containers[*]}{.name} {.resources.requests}{"\n"}{end}'
# Annotations in the pod template
kubectl -n kurz get deploy kurz -o jsonpath='{.spec.template.metadata.annotations}{"\n"}'Expected:
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
keda-hpa-kurz Deployment/kurz 0/1 (avg), cpu: <unknown>/200% 3 6 3 46m
False FailedGetResourceMetric: the HPA was unable to compute the replica count: failed to get cpu utilization: missing request for cpu in container linkerd-proxy of Pod kurz-68f7847c7f-thmkz
linkerd-init {"memory":"20Mi"}
linkerd-proxy {"memory":"20Mi"}
kurz {"cpu":"250m","memory":"32Mi"}
{"config.linkerd.io/proxy-memory-request":"20Mi","kubectl.kubernetes.io/restartedAt":"2026-11-25T23:26:02Z","linkerd.io/inject":"enabled"}
Cause: The annotation
config.linkerd.io/proxy-cpu-request is missing from the pod
template. Without it, the injector sets no CPU request for the Linkerd
proxy, and the HPA can only calculate a utilization in percent if
every container has one (Day 9, Day 13). The cron
trigger keeps delivering (0/1), the CPU is
<unknown>. The file from Day 13 contains the
annotation:
# on s1
# Difference to the file from Day 13, apply, wait
kubectl diff -f ../tag13/kurz-ende.yaml | grep -E '^[-+] ' | grep -v generation
kubectl apply -f ../tag13/kurz-ende.yaml && kubectl -n kurz rollout status deploy kurz | tail -1
# The HPA needs a measurement from the metrics-server
sleep 60
kubectl -n kurz get hpa keda-hpa-kurz -o jsonpath='{.status.conditions[?(@.type=="ScalingActive")].status} {.status.conditions[?(@.type=="ScalingActive")].reason}{"\n"}'
kubectl -n kurz get hpa keda-hpa-kurzExpected:
+ config.linkerd.io/proxy-cpu-request: 100m
configmap/kurz unchanged
deployment.apps/kurz configured
service/kurz unchanged
deployment "kurz" successfully rolled out
True ValidMetricFound
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
keda-hpa-kurz Deployment/kurz 0/1 (avg), cpu: 1%/200% 3 6 3 47m
Here apply helps, unlike in Task 5: the annotation is in
the file, so apply sets it again. The
restartedAt annotation from Task 3 does no harm. It comes
from kubectl, is not in the file and stays.
Solution 8
# on s1
# One customer at 100/s
st -e RATE=100 -e NUTZER=1
# Rule and state of the policy
kubectl -n kurz get btp kurz-retry -o jsonpath='{.spec.rateLimit.global.rules[0]}{"\n"}'
kubectl -n kurz get btp kurz-retry -o jsonpath='{.status.ancestors[0].conditions[0].type}={.status.ancestors[0].conditions[0].status}{"\n"}'
# Function rlstat: counters of the global limit in both Envoy pods (as on Day 11)
rlstat() { for p in $(kubectl -n envoy-gateway-system get pods -l gateway.envoyproxy.io/owning-gateway-name=web -o name); do
kubectl -n envoy-gateway-system port-forward $p 19000:19000 >/dev/null 2>&1 & PF=$!; sleep 2
curl -s localhost:19000/stats | grep -E 'rule/0.ratelimit\.(ok|over_limit|failure_mode_allowed):' | sed 's/.*ratelimit\.//' | tr '\n' ' '; echo
kill $PF; sleep 1; done; }
rlstat
# Rate limit service and its store
kubectl -n envoy-gateway-system get deploy envoy-ratelimit ratelimit-valkey
kubectl -n envoy-gateway-system logs deploy/envoy-ratelimit --since=1m | tail -3 | cut -c1-200Expected (the counters have been running since the Envoy pods started):
http_req_duration{status:302} p(95)=217.66ms
http_reqs{status:302} count=2001
{"clientSelectors":[{"headers":[{"invert":false,"name":"X-Nutzer","type":"Distinct"}]}],"limit":{"requests":50,"unit":"Second"}}
Accepted=True
failure_mode_allowed: 1001 ok: 220 over_limit: 220
failure_mode_allowed: 1000 ok: 299 over_limit: 262
NAME READY UP-TO-DATE AVAILABLE AGE
envoy-ratelimit 1/1 1 1 4h
ratelimit-valkey 0/0 0 0 4h2m
time="2026-11-25T23:49:31Z" level=error msg="creating redis connection error : dial tcp 10.43.20.110:6379: i/o timeout"
time="2026-11-25T23:49:37Z" level=error msg="creating redis connection error : dial tcp 10.43.20.110:6379: i/o timeout"
time="2026-11-25T23:49:43Z" level=error msg="creating redis connection error : dial tcp 10.43.20.110:6379: i/o timeout"
Cause: The store of the rate limit service
(ratelimit-valkey) has zero replicas. The service itself is
running but cannot count. Envoy waits until the 200 ms deadline (Day 11)
and then lets the request through unchecked: fail open. Exactly 2001
requests are counted as failure_mode_allowed, and p95 rises
from 36 to 218 ms, because every request sits out the deadline. The
policy is correct and accepted. Anyone who only checks the policy finds
nothing.
# on s1
# Start the store again, give the service time to connect
kubectl -n envoy-gateway-system scale deploy ratelimit-valkey --replicas=1
kubectl -n envoy-gateway-system rollout status deploy ratelimit-valkey | tail -1
sleep 15
# The same customer
st -e RATE=100 -e NUTZER=1Expected:
deployment.apps/ratelimit-valkey scaled
deployment "ratelimit-valkey" successfully rolled out
http_req_duration{status:302} p(95)=27.42ms
http_req_duration{status:429} p(95)=10.29ms
http_reqs{status:302} count=1015
http_reqs{status:429} count=986
About 50 × 20 = 1000 redirects, the rest 429, and p95 is
back to normal. The store has no persistence (Day 11): after a restart
all counters start at zero, which does not matter for limits per second.
An alert on failure_mode_allowed would have reported the
fault immediately.
Solution 9
# on s1
# Function mesh: load from the pod last directly to the Service kurz (as on Day 12)
mesh() { kubectl -n kurz exec deploy/last -c k6 -- k6 run -q -e ZIEL=http://kurz.kurz.svc.cluster.local "$@" status2.js; }
# Error rate and redirects from the mesh
mesh -e RATE=100 -e DAUER=10s 2>&1 | grep -E 'http_req_failed\.|http_reqs\.' | sed 's/ */ /g'
mesh -e RATE=100 -e DAUER=10s 2>&1 | grep -A1 -E 'http_reqs\{status:302\}' | sed 's/ */ /g' | paste - -
# A single request from the pod: one code and /readyz
kubectl -n kurz exec deploy/last -c k6 -- wget -q -O /dev/null http://kurz.kurz.svc.cluster.local/jjUJgoJ 2>&1
kubectl -n kurz exec deploy/last -c k6 -- wget -q -O /dev/null http://kurz.kurz.svc.cluster.local/readyz 2>&1
# Through the Gateway
st -e RATE=100 -e DAUER=10s
# Did kurz see anything at all?
kubectl -n kurz logs -l app=kurz -c kurz --since=1m --tail=-1 | wc -l
# Rules and state of the mesh route
kubectl -n kurz get httproute kurz-mesh -o jsonpath='{.spec.rules[0].matches}{"\n"}'
kubectl -n kurz get httproute kurz-mesh -o jsonpath='{range .status.parents[*]}{.controllerName}: {range .conditions[*]}{.type}={.status} {end}{"\n"}{end}'Expected:
http_req_failed......: 100.00% 1000 out of 1000
http_reqs............: 1000 99.974683/s
http_reqs{status:302} ✓ 'count>=0' count=0
wget: server returned error: HTTP/1.1 404 Not Found
command terminated with exit code 1
wget: server returned error: HTTP/1.1 404 Not Found
command terminated with exit code 1
http_req_duration{status:302} p(95)=22.11ms
http_reqs{status:302} count=1000
0
[{"path":{"type":"PathPrefix","value":"/api/"}}]
linkerd.io/policy-controller: Accepted=True ResolvedRefs=True
Cause: The HTTPRoute kurz-mesh is
attached to the Service kurz and therefore applies to
every request to this Service from the mesh (Day 12).
Its only rule now matches only /api/. Anything that matches
no rule is answered by the client’s Linkerd proxy itself with
404, including /readyz. Nothing arrives at
kurz, which is why its log is empty. Envoy is not in the
mesh and goes directly to the endpoints, which is why the Gateway keeps
working.
# on s1
# Difference to the file from Day 12, apply
kubectl diff -f ../tag12/route-timeout.yaml | grep -E '^[-+] ' | grep -v generation
kubectl apply -f ../tag12/route-timeout.yaml
sleep 10
# Measure from the mesh again
mesh -e RATE=100 -e DAUER=10s 2>&1 | grep -E 'http_req_failed\.|http_reqs\.' | sed 's/ */ /g'
mesh -e RATE=100 -e DAUER=10s 2>&1 | grep -A1 -E 'http_reqs\{status:302\}' | sed 's/ */ /g' | paste - -Expected:
- value: /api/
+ value: /
httproute.gateway.networking.k8s.io/kurz-mesh configured
http_req_failed................: 0.00% 0 out of 1001
http_reqs......................: 1001 99.981198/s
http_reqs{status:302} ✓ 'count>=0' count=1000
If you want a route only for some of the paths (for example retries
only for /api/), you need a second rule with
PathPrefix / as a catch-all rule.
Solution 10
# on s1
# Port-forward to both Envoy pods: 19000 and 19001, remember the PIDs
PF=""; i=0
for p in $(kubectl -n envoy-gateway-system get pods -l gateway.envoyproxy.io/owning-gateway-name=web -o name); do
kubectl -n envoy-gateway-system port-forward $p $((19000 + i)):19000 >/dev/null 2>&1 & PF="$PF $!"; i=$((i + 1))
done
# 40 s of load in the background
(k6 run -q -e ZIEL=http://172.16.0.126 -e RATE=800 -e DAUER=40s mix.js > k6-little.txt 2>&1 &)
# After 10 s: 20 samples one second apart, open requests of both Envoys to kurz added up
sleep 10
for n in $(seq 20); do
a=$(curl -s localhost:19000/stats | awk -F': ' '/httproute\/kurz\/kurz\/rule\/0\.upstream_rq_active:/ {print $2}')
b=$(curl -s localhost:19001/stats | awk -F': ' '/httproute\/kurz\/kurz\/rule\/0\.upstream_rq_active:/ {print $2}')
echo $((a + b)); sleep 1
done | awk '{s += $1; n++} END {printf "%d Proben, im Mittel %.1f gleichzeitig\n", n, s/n}'
# Wait for the end of the load, stop the port-forwards
sleep 12; kill $PF
# Throughput and mean duration as seen by k6
grep -E 'http_req_duration\.|http_reqs\.' k6-little.txt | sed 's/ */ /g'Expected:
20 Proben, im Mittel 23.4 gleichzeitig
http_req_duration..............: avg=45.82ms min=2.87ms med=23.69ms max=1.18s p(90)=100.62ms p(95)=159.14ms
http_reqs......................: 31670 790.684192/s
Answer: Little’s Law (Day 2): L = λ × W = 790.7/s ×
0.0458 s ≈ 36 concurrent requests. Envoy counts on average 23.4 open
requests to kurz (“20 Proben, im Mittel 23.4 gleichzeitig”
= 20 samples, on average 23.4 at once). The difference is time that k6
measures but the Envoys do not attribute to the path to
kurz: the path from k6 via ServiceLB to the Envoys, the
work in Envoy itself, and k6 waiting for CPU on s1, where it shares the
cores with the k3s server and a kurz pod. 20 samples are
also a rough estimate. A second run gave 57 versus 43; the gap
remains.
For the circuit breaker this means: it allows 100 parallel requests per Envoy, 200 together. At 800 per second, a good tenth of that is in use. But Little’s Law also tells you when it gets tight: occupancy grows with rate and duration. If at 1500 per second the duration rises to a few hundred milliseconds, several hundred are in flight at once, and the circuit breaker rejects. That is exactly where the errors began on Day 14 (1500/s: 4.49%, p95 287 ms).
Scoring
| Result | Rating |
|---|---|
| 90–100% | Platform architect: you operate, measure and justify |
| 70–80% | Solid: the fundamentals are in place, and now you know your gaps |
| below 70% | Repeat the days covering the tasks you missed |
| Task | Days |
|---|---|
| 1 Route to the wrong port | 3 |
| 2 Cache too small, cold start under load | 5, 12 |
| 3 PDB blocks the drain | 13 |
| 4 Switchover under load | 6, 7, 12, 13 |
| 5 Stream full, core publish | 8, 14, 2 |
| 6 Wrong threshold in KEDA | 10 |
| 7 Proxy without CPU request | 9, 12, 13 |
| 8 Rate limit fails open | 11 |
| 9 Mesh route without catch-all rule | 12 |
| 10 Little’s Law at the Gateway | 2, 11, 14 |
Clean-up
All solutions restore the target state, except for the primary from
Task 4. If you did not solve a task, run its repair commands anyway.
Finally, move the primary back to zone-a and compare with
the state after Day 15:
# on s1
# Primary back to db-1 as soon as all three instances are ready
until [ "$(kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances}')" = 3 ]; do sleep 3; done
kubectl cnpg promote db db-1 -n kurz 2>/dev/null
# Wait for the switchover
sleep 20
until [ "$(kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances}')" = 3 ]; do sleep 3; done
sleep 10
# Database: three instances, healthy, primary db-1
kubectl -n kurz get cluster db --no-headers | awk '{print $3, $4, $5, $6, $7, $8, $9}'
# Task 1: route on port 80, resolved
kubectl -n kurz get httproute kurz -o jsonpath='{.spec.rules[0].backendRefs[0].port} {.status.parents[0].conditions[1].type}={.status.parents[0].conditions[1].status}{"\n"}'
# Task 9: mesh route with catch-all rule
kubectl -n kurz get httproute kurz-mesh -o jsonpath='{.spec.rules[0].matches[0].path.value}{"\n"}'
# Task 2: cache ready, 64 MB
kubectl -n kurz get valkeycluster cache -o jsonpath='{.status.state} {.spec.config.maxmemory}{"\n"}'
# Task 3: PDB at least 2, one disruption allowed
kubectl -n kurz get pdb kurz -o jsonpath='{.spec.minAvailable} {.status.disruptionsAllowed}{"\n"}'
# Pooler with two instances and the time limits from Day 7
kubectl -n kurz get pooler db-pooler-rw -o jsonpath='{.spec.instances} {.spec.pgbouncer.parameters.server_login_retry} {.spec.pgbouncer.parameters.server_connect_timeout}{"\n"}'
# Task 5: stream without byte limit
kubectl -n kurz get streams.jetstream.nats.io klicks -o jsonpath='{.spec.discard} {.spec.maxBytes}{"\n"}'
# Task 6: threshold 500
kubectl -n kurz get scaledobject zaehler -o jsonpath='{.spec.triggers[0].metadata.lagThreshold}{"\n"}'
# Task 7: minimum 3, CPU measurement works
kubectl -n kurz get hpa keda-hpa-kurz -o jsonpath='{.spec.minReplicas} {.status.conditions[?(@.type=="ScalingActive")].status}{"\n"}'
# Task 8: rate limit service and store are running
kubectl -n envoy-gateway-system get deploy ratelimit-valkey envoy-ratelimit -o custom-columns=NAME:.metadata.name,READY:.status.readyReplicas --no-headers
# All nodes ready, none cordoned
kubectl get nodes --no-headers | awk '{print $1, $2}'Expected:
Node db-1 in cluster db will be promoted
3 3 Cluster in healthy state db-1
80 ResolvedRefs=True
/
Ready 64mb
2 1
2 1 2
old -1
500
3 True
ratelimit-valkey 1
envoy-ratelimit 1
s1 Ready
s2 Ready
s3 Ready