Appendix B: Final Exam
Goal: Prove that you can build and repair a Gateway with routes, TLS, policies and migration on your own · Duration: 120 min hands-on + 20 min questions · Prerequisite: Day 14
Rules
- Cluster: kind
gw-labon the laptop, state after Day 7 (Envoy Gateway v1.9.2, cert-manager withClusterIssuer lab-ca,payments-apifrom Day 7).cloud-provider-kindruns in the second terminal. - Everything attaches to a new Gateway
infra/pruefungwith its own IP. Hostnames:*.pruefung.gw.localtest.me. The lab objects from Days 1–7 stay untouched. - Allowed:
kubectl explain,--help, Appendix A, gateway-api.sigs.k8s.io and gateway.envoyproxy.io. Not allowed: copying solutions from the chapters. - A task only counts if the check script reports it with ✔.
- Passed: at least 70 of 100 points and Task 8 fully solved.
Fresh lab? Then in this order (commands from Days 0, 4 and 7):
~/gw-lab/code/demo/up.sh
helm upgrade --install cert-manager oci://quay.io/jetstack/charts/cert-manager \
--version v1.21.2 -n cert-manager --create-namespace \
--set crds.enabled=true --set config.gatewayAPI.enabled=true --wait
kubectl apply -f ~/gw-lab/code/tag04/lab-ca.yaml
kubectl apply -f ~/gw-lab/code/tag07/payments-api.yamlStart:
mkdir -p ~/gw-lab/pruefung && cd ~/gw-lab/pruefung
export PATH="$HOME/gw-lab/code/demo:$PATH" CA=~/gw-lab/tag04/lab-ca.crt
kubectl config use-context kind-gw-lab
kubectl wait clusterissuer/lab-ca --for=condition=Ready --timeout=10s
kubectl -n payments get deploy payments-apiExpected:
Switched to context "kind-gw-lab".
clusterissuer.cert-manager.io/lab-ca condition met
NAME READY UP-TO-DATE AVAILABLE AGE
payments-api 1/1 1 1 2d
Part 1: Practical Exam
Task 1: Gateway With Wildcard TLS (10 Points)
Create the Gateway pruefung in infra
(GatewayClass eg):
- Listener
http(port 80), only routes from its own namespace. - Listener
https(port 443) for*.pruefung.gw.localtest.me, certificatepruefung-tlsvia the gateway-shim fromlab-ca. Only routes from namespaces withgw-lab/teamequal toshoporpayments.
kubectl -n infra wait gateway/pruefung --for=condition=Programmed --timeout=5s
gw-ip.sh pruefung infra
kubectl -n infra get certificate pruefung-tls -o jsonpath='{.spec.dnsNames}{"\n"}'Expected (the IP differs):
gateway.gateway.networking.k8s.io/pruefung condition met
172.18.0.9
["*.pruefung.gw.localtest.me"]
Task 2: Redirect HTTP to HTTPS (5 Points)
Every request on port 80 gets a 301 to the same URL with
https. The route is called pruefung-redirect
and lives in infra.
IP=$(gw-ip.sh pruefung infra)
curl -sI --resolve shop.pruefung.gw.localtest.me:80:$IP \
'http://shop.pruefung.gw.localtest.me/x?y=1' | grep -iE '^(HTTP|location)'Expected:
HTTP/1.1 301 Moved Permanently
location: https://shop.pruefung.gw.localtest.me/x?y=1
Task 3: Shop With Matching and Canary (15 Points)
HTTPRoute pruefung-shop in shop for
shop.pruefung.gw.localtest.me:
/v2and everything below →shop-v2.- Header
x-canary: always→ alwaysshop-v2. - Everything else: 90%
shop-v1, 10%shop-v2.
Task 4: API With Rewrite, Header and Timeout (10 Points)
HTTPRoute pruefung-api in shop for
api.pruefung.gw.localtest.me: everything under
/api goes to shop-v1 without the prefix
(/api/produkte → /produkte), every response
carries x-pruefung: bestanden, and the Gateway aborts after
2 s (504).
Task 5: Cross-Namespace With ReferenceGrant (10 Points)
The payments team publishes pay.pruefung.gw.localtest.me
with an HTTPRoute pruefung-pay in the namespace
payments that points to the Service
shop-v1 in shop. The grant is called
pruefung-pay and applies only to exactly this Service.
Task 6: Rate Limit (10 Points)
BackendTrafficPolicy pruefung-limit on
pruefung-api: at most 5 requests per second (local, without
Redis). The policy must report Accepted=True.
Task 7: Basic Auth for /admin (10 Points)
https://shop.pruefung.gw.localtest.me/admin only with
user pruefer and password lab-pruef-1234 (lab
value). A separate route pruefung-admin in
shop to shop-v1, SecurityPolicy
pruefung-admin, Secret pruefung-users.
Task 8: Repair a Broken Route (15 Points, Mandatory)
A colleague created this route.
https://kaputt.pruefung.gw.localtest.me/ should deliver
shop-v1. Repair only the route; the
Gateway and Service stay as they are. There are three errors.
cat > kaputt.yaml <<'EOF'
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: pruefung-kaputt
namespace: shop
spec:
parentRefs:
- name: pruefung
namespace: infra
sectionName: https-shop
hostnames:
- kaputt.gw.localtest.me
rules:
- backendRefs:
- name: shop-v1
port: 8080
EOF
kubectl apply -f kaputt.yaml
conds.sh httproute pruefung-kaputt shopExpected (shortened, may differ depending on the version):
httproute.gateway.networking.k8s.io/pruefung-kaputt created
parent infra/pruefung/https-shop:
Accepted=False (NoMatchingParent): No listeners match this parent ref
...
For each error, note the condition by which you recognized it.
Task 9: Two Envoy Replicas (5 Points)
The Gateway pruefung runs with two Envoy pods. Use an
EnvoyProxy object pruefung-proxy in
infra for this, not kubectl scale.
Task 10: Migrate an Ingress (10 Points)
Translate this Ingress with ingress2gateway (offline)
and attach the result to infra/pruefung, listener
https.
https://legacy.pruefung.gw.localtest.me/alt/x must arrive
at shop-v2 as /x. The route is called
pruefung-legacy. You do not apply the Ingress itself.
cat > legacy-ingress.yaml <<'EOF'
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: legacy
namespace: shop
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- host: legacy.pruefung.gw.localtest.me
http:
paths:
- path: /alt(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: shop-v2
port:
number: 80
EOF
ingress2gateway print --providers=ingress-nginx --input-file legacy-ingress.yaml \
-A --no-color > legacy-gw.yaml 2> legacy-warnungen.txt
grep -c 'kind: HTTPRoute' legacy-gw.yamlExpected:
1
Check Script
cat > ~/gw-lab/pruefung/pruefung-check.sh <<'EOF'
#!/usr/bin/env bash
# Appendix B: check script – counts points per task
# shellcheck disable=SC2016 # check commands are in '…' and run via eval
set -uo pipefail
CA="${CA:-$HOME/gw-lab/tag04/lab-ca.crt}"
IP=$(gw-ip.sh pruefung infra) || exit 1
D=pruefung.gw.localtest.me
total=0; a8=0
pt() { # pt <points> <text> <check command>
if eval "$3" >/dev/null 2>&1; then
total=$((total + $1)); printf '✔ %2s %s\n' "$1" "$2"; return 0
fi
printf '✘ 0 %s\n' "$2"; return 1
}
c() { # c <host> [path] [curl options ...]: HTTPS against the exam Gateway
curl -s --max-time 5 --cacert "$CA" --resolve "$1.$D:443:$IP" "${@:3}" \
"https://$1.$D${2:-/}"
}
svc() { c "$@" | jq -r .service; }
st() { c "$@" -o /dev/null -w '%{http_code}'; }
anteil_v2() { # 200 requests, shop-v2 must be between 8 and 40
local n; n=$(for _ in $(seq 200); do svc shop; done | grep -c shop-v2)
[ "$n" -ge 8 ] && [ "$n" -le 40 ]
}
ok_conds() { # all conditions of all parents True (except RouteRulesOverlap)
kubectl -n "$1" get httproute "$2" -o json | jq -e '[.status.parents[].conditions[]
| select(.type != "RouteRulesOverlap" and .status != "True")] | length == 0'
}
echo "== A1"
pt 5 "Gateway pruefung Programmed" \
'kubectl -n infra wait gateway/pruefung --for=condition=Programmed --timeout=5s'
pt 5 "Wildcard-Zertifikat aus lab-ca" 'openssl s_client -connect "$IP:443" \
-servername "shop.$D" </dev/null 2>/dev/null | openssl x509 -noout -text \
| grep -q "DNS:\*\.$D"'
echo "== A2"
pt 5 "HTTP -> 301 HTTPS" 'curl -sI --resolve "shop.$D:80:$IP" "http://shop.$D/x" \
| grep -qi "^location: https://shop.$D/x"'
echo "== A3"
pt 5 "/v2 -> shop-v2" '[ "$(svc shop /v2/a)" = shop-v2 ]'
pt 5 "x-canary: always -> shop-v2" '[ "$(svc shop / -H "x-canary: always")" = shop-v2 ]'
pt 5 "Rest 90/10" 'anteil_v2'
echo "== A4"
pt 4 "Rewrite /api/produkte -> /produkte" \
'[ "$(c api /api/produkte | jq -r .path)" = /produkte ]'
pt 3 "Header x-pruefung" \
'c api /api/ -D - -o /dev/null | grep -qi "^x-pruefung: bestanden"'
pt 3 "Timeout 504" '[ "$(st api "/api/x?delay=3s")" = 504 ]'
echo "== A5"
pt 3 "ReferenceGrant auf genau shop-v1" 'kubectl -n shop get referencegrant \
pruefung-pay -o json | jq -e "[.spec.to[]
| select(.kind == \"Service\" and .name == \"shop-v1\")] | length == 1"'
pt 7 "pay -> shop-v1 aus payments" '[ "$(svc pay)" = shop-v1 ] \
&& kubectl -n payments get httproute pruefung-pay'
echo "== A6"
pt 5 "Policy pruefung-limit Accepted" 'kubectl -n shop get backendtrafficpolicy \
pruefung-limit -o json | jq -e ".status.ancestors[0].conditions[]
| select(.type == \"Accepted\" and .status == \"True\")"'
pt 5 "429 bei 30 schnellen Requests" '[ "$(for _ in $(seq 30); do st api /api/;
echo; done | grep -c 429)" -gt 0 ]'
echo "== A7"
pt 5 "/admin ohne Login 401" '[ "$(st shop /admin)" = 401 ]'
pt 5 "/admin mit Login 200" '[ "$(st shop /admin -u pruefer:lab-pruef-1234)" = 200 ]'
echo "== A8 (Pflicht)"
pt 10 "kaputt -> shop-v1" '[ "$(svc kaputt)" = shop-v1 ]' && a8=$((a8 + 1))
pt 5 "pruefung-kaputt ohne False" 'ok_conds shop pruefung-kaputt' && a8=$((a8 + 1))
echo "== A9"
pt 5 "2 Envoy-Replikas über EnvoyProxy" 'kubectl -n infra get envoyproxy \
pruefung-proxy && [ "$(kubectl -n envoy-gateway-system get deploy \
-l gateway.envoyproxy.io/owning-gateway-name=pruefung \
-o jsonpath="{.items[0].status.readyReplicas}")" = 2 ]'
echo "== A10"
pt 10 "legacy /alt/x -> /x bei shop-v2" 'kubectl -n shop get httproute \
pruefung-legacy && [ "$(c legacy /alt/x | jq -r ".path + \" \" + .service")" \
= "/x shop-v2" ]'
echo "== Ergebnis: $total von 100 Punkten"
if [ "$total" -ge 70 ] && [ "$a8" -eq 2 ]; then echo "✔ BESTANDEN"
else echo "✘ NICHT BESTANDEN (70 Punkte und Aufgabe 8 nötig)"; fi
EOF
chmod +x ~/gw-lab/pruefung/pruefung-check.sh
~/gw-lab/pruefung/pruefung-check.shExpected with a complete solution (shortened, may differ depending on the version):
== A1
✔ 5 Gateway pruefung Programmed
✔ 5 Wildcard-Zertifikat aus lab-ca
== A2
✔ 5 HTTP -> 301 HTTPS
...
== A10
✔ 10 legacy /alt/x -> /x bei shop-v2
== Ergebnis: 100 von 100 Punkten
✔ BESTANDEN
The script is idempotent – run it after every task. The A6 check deliberately sends more than five requests per second; right afterwards, individual A4 checks may briefly see 429. In that case just wait a second and run it again.
Points
| Task | Topic | Points | achieved |
|---|---|---|---|
| 1 | Gateway with wildcard TLS | 10 | |
| 2 | HTTP → HTTPS | 5 | |
| 3 | Matching and canary | 15 | |
| 4 | Rewrite, header, timeout | 10 | |
| 5 | ReferenceGrant | 10 | |
| 6 | Rate limit | 10 | |
| 7 | Basic auth | 10 | |
| 8 | Troubleshooting (mandatory) | 15 | |
| 9 | EnvoyProxy | 5 | |
| 10 | Ingress migration | 10 | |
| Total | 100 |
Clean up after the exam:
kubectl -n infra delete gateway pruefung
kubectl -n infra delete httproute pruefung-redirect
kubectl -n infra delete envoyproxy pruefung-proxy
kubectl -n infra delete secret pruefung-tls
kubectl -n shop delete httproute pruefung-shop pruefung-api pruefung-admin \
pruefung-kaputt pruefung-legacy
kubectl -n shop delete backendtrafficpolicy pruefung-limit
kubectl -n shop delete securitypolicy pruefung-admin
kubectl -n shop delete secret pruefung-users
kubectl -n shop delete referencegrant pruefung-pay
kubectl -n payments delete httproute pruefung-payPart 2: Short Questions
1 point each, passing threshold 18 of 25. Answer in one sentence.
- Which three roles does the Gateway API separate, and which resource belongs to which?
- What does a GatewayClass with
Accepted=Unknownand reasonPendingmean? - How do
AcceptedandProgrammeddiffer on the Gateway? - How are several entries under
matchescombined, and the fields within one entry? - Does
PathPrefix /v2match/v2x? Why (not)? - Two equally specific rules from two routes claim the same path. Who wins?
- A route has
ResolvedRefs=False (BackendNotFound). What does the client see? - Where do you create a ReferenceGrant when a route in
shoppoints to a Service inpayments? - Which fields does a listener need for the cert-manager gateway-shim to issue a certificate?
- What distinguishes
tls.mode: TerminatefromPassthrough, and which route kind belongs to passthrough? - What is
validation.hostnamein a BackendTLSPolicy for? - What does
weight: 0mean, and why do you leave a backend in the route like that? - Why is a canary with weights not a health check?
- What exactly does
retry.attempts: 3count? - What distinguishes
timeouts.requestfromtimeouts.backendRequest? - Which Envoy Gateway policy do you use for a rate limit, which for JWT, which for client timeouts?
- Why does a local rate limit of 10/s let more than 10 requests through with two Envoy pods?
- What happens to requests by default when Redis fails for the global rate limit?
- Why does Cilium L2 need
externalTrafficPolicy: Clusteron the Envoy Service? - What does the ValidatingAdmissionPolicy
safe-upgrades.gateway.networking.k8s.ioblock, and what not? - In which order do you upgrade Envoy Gateway, and why doesn’t
helm upgradedo this on its own? - What is the Envoy cluster of the first rule of the HTTPRoute
shop/shopcalled, and what do you need the name for? - What do the response flags
UHandRLSEmean? - Name two annotations that
ingress2gatewaydoes not translate or translates incorrectly. - What is an InferencePool, and who picks the pod for a request within it?
Answer Key
- Infrastructure provider/cluster operator: GatewayClass; platform team: Gateway; app teams: Routes (and ListenerSets).
- No controller has claimed the class – the
controllerNamematches no installed implementation. Accepted: the spec is valid;Programmed: the data plane is configured and has an address.- Multiple
matchesentries are OR, conditions within one entry are AND. - No:
PathPrefixcompares whole path segments,/v2xis a different segment. - The older route (
creationTimestamp), on a tie alphabetically bynamespace/name; Envoy Gateway reportsRouteRulesOverlap. - HTTP 500 for the affected rule – the route is accepted, its backend is not.
- In the target namespace
payments,fromHTTPRoute fromshop,toService (ideally withname). protocol: HTTPS,hostname,tls.mode: TerminateandcertificateRefs(name = Secret) plus the issuer annotation on the Gateway.- Terminate decrypts at the Gateway (L7 possible), passthrough passes TLS through unchanged by SNI – with TLSRoute.
- Envoy sends it as SNI to the backend and verifies the backend certificate against it.
- The backend gets no traffic, but stays in place for a rollback by swapping numbers.
- Weights also distribute to backends without endpoints – their share ends in 503.
- Three retries, so up to four attempts in total.
requestlimits the total time until the response to the client including retries,backendRequesteach individual attempt.- BackendTrafficPolicy (rate limit), SecurityPolicy (JWT), ClientTrafficPolicy (client timeouts).
- Each Envoy pod has its own token bucket.
- They pass through without a limit (fail-open); only with
rateLimit.failClosed: truedo you get 500. - Otherwise the IP may be announced on a node where no Envoy pod runs, and the traffic is lost.
- It blocks CRD bundles below v1.5 and Experimental over Standard; it lets Standard over Experimental through.
- Release notes, CRDs
(
helm template … | kubectl apply --server-side), controller, proxies – Helm only installs CRDs on the firstinstall. httproute/shop/shop/rule/0– the labelenvoy_cluster_nameis the route key in PromQL and in the access log.UH: no healthy upstream (no endpoints);RLSE: rate limit service unreachable.- For example
rewrite-targetwith capture groups (missing),proxy-read-timeout(different value), snippets,auth-url. - A backend object (
inference.networking.k8s.io/v1) for model server pods; the Endpoint Picker (EPP) picks the pod viaext_proc.
Part 3: Self-Assessment
| Topic | I can do it | done in the lab |
|---|---|---|
| Resource model, reading conditions (Day 1) | [ ] | [ ] |
| Gateway, listeners, matching (Day 2) | [ ] | [ ] |
| Filters, timeouts, retries (Day 3) | [ ] | [ ] |
| TLS, cert-manager, passthrough, BackendTLSPolicy (Day 4) | [ ] | [ ] |
| Canary and blue-green (Day 5) | [ ] | [ ] |
| GRPCRoute, TCPRoute, UDPRoute (Day 6) | [ ] | [ ] |
| allowedRoutes, ReferenceGrant, ListenerSet, RBAC (Day 7) | [ ] | [ ] |
| RKE2 HA on Proxmox with Cilium (Day 8) | [ ] | [ ] |
| LB IPAM, L2, two GatewayClasses, DNS (Day 9) | [ ] | [ ] |
| Client, backend, security policies (Day 10) | [ ] | [ ] |
| Metrics, access logs, tracing, status alerts (Day 11) | [ ] | [ ] |
| HPA, PDB, drain, upgrades, certificate rotation (Day 12) | [ ] | [ ] |
| Ingress migration with parallel operation (Day 13) | [ ] | [ ] |
| Disaster drills under time pressure (Day 14) | [ ] | [ ] |
Any row without two checkmarks: work through that chapter once more.