Part A – Services and Routes
Exam-style hands-on labs with Kong Manager (UI) steps, Admin API / decK / CLI commands, verification and gotchas.
Honest note: the real exam questions are confidential, so nobody can give you the exact ones. These labs are modelled on the published exam objectives (services/routes, upstreams and health checks, consumers and authentication, plugins, traffic control, transformations, logging, workspaces/RBAC, decK/DB-less, hybrid mode, TLS, CLI and troubleshooting) and on the style of tasks you are expected to perform: configure it, then prove it works.
0. Lab environment and assumptions
| Item | Value |
|---|---|
| Kong Gateway | 3.x (OSS or Enterprise; Enterprise-only labs are marked [EE]) |
| Admin API | http://localhost:8001 |
| Kong Manager | http://localhost:8002 |
| Proxy | http://localhost:8000 (HTTPS :8443) |
| Upstream test app | http://httpbin.org (or a local kong/httpbin / mccutchen/go-httpbin container) |
# Handy aliases used in all labs
export ADMIN=http://localhost:8001
export PROXY=http://localhost:8000
Universal verification checklist (use this on EVERY task)
- Config exists:
curl -s $ADMIN/services | jq,/routes,/plugins,/consumers,/upstreams/<name>/targets. - Traffic test with headers visible:
curl -i ...(never plaincurl– status line and headers are your evidence). - Read the status code:
| Code | Usual Kong meaning |
|---|---|
| 200/2xx | Route matched, upstream answered |
| 400 | Bad request / invalid header / plugin validation |
| 401 | Authentication plugin: missing or invalid credentials |
| 403 | Authenticated but not authorised (ACL, ip-restriction, invalid key scope) |
404 no Route matched with those values | No route matched (path/host/method/header) – the problem is the route |
| 413 | request-size-limiting |
| 429 | rate-limiting |
| 500 | Plugin or Kong internal error – check error.log |
| 502 | Kong reached/parsed upstream badly (connection refused, bad response) |
| 503 | No healthy target / name resolution failed / service unavailable |
| 504 | Upstream timed out (read/send/connect timeout) |
- Useful response headers:
X-Kong-Upstream-Latency,X-Kong-Proxy-Latency,Via: kong/x.y,X-RateLimit-Limit-Minute,X-RateLimit-Remaining-Minute,RateLimit-*,X-Cache-Status,X-Kong-Request-Id. - Logs: default prefix
/usr/local/kong/logs/→error.log,access.log. In Docker:docker logs <kong>. - Declarative / DB-less mode is read-only through the Admin API (POST/PUT/PATCH/DELETE return 405). Change
kong.ymland reload. - Scope matters: a plugin may exist but be attached to a different route/service/consumer than the one you test.
Plugin precedence (most specific wins – only ONE instance of a plugin runs per request)
Consumer + Route + Service → Consumer + Route → Consumer + Service → Route + Service → Consumer → Route → Service → Global.
Part A – Services and Routes
Lab 1 – Create a Service and Route in Kong Manager
Task: Create a Gateway Service orders-svc pointing to http://httpbin.org and a Route orders-route with path /anything so that GET /anything/hello reaches the upstream.
UI:
- Kong Manager → workspace default → Gateway Services → New Gateway Service.
- Name
orders-svc, choose Add using URL, URLhttp://httpbin.org→ Create. - Open the service → Routes tab → New Route (or Routes → New Route).
- Name
orders-route, Serviceorders-svc, Paths/anything, Protocolshttp, https→ Create.
Verify:
curl -i $PROXY/anything/hello
Expect 200 and a JSON body with "url": "http://localhost/anything/hello"-style content and a Via: kong/... header.
Keep in mind: a Route does nothing without a Service (unless a plugin like request-termination is used). Names must be unique per workspace.
Lab 2 – Same task using the Admin API
Task: Create the service and route from the command line and prove they exist.
curl -i -X POST $ADMIN/services \
--data name=orders-svc \
--data url=http://httpbin.org
curl -i -X POST $ADMIN/services/orders-svc/routes \
--data name=orders-route \
--data 'paths[]=/anything'
Verify:
curl -s $ADMIN/services/orders-svc | jq '{name,host,port,protocol,path}'
curl -s $ADMIN/routes/orders-route | jq '{name,paths,strip_path,service}'
curl -i $PROXY/anything/hello
Keep in mind:
- Form data uses
paths[]=/x; JSON needs-H 'Content-Type: application/json'and"paths":["/x"]. - A
urlshortcut on the service is split intoprotocol,host,port,path. PUT /services/orders-svcis create-or-replace;PATCHis partial update.
Lab 3 – strip_path behaviour
Task: Requests to /anything/test must reach httpbin as /anything/test (path NOT stripped). Then show what happens when it is stripped.
UI: Routes → orders-route → Edit → toggle Strip Path off → Save.
# strip_path=false : upstream receives /anything/test
curl -s -X PATCH $ADMIN/routes/orders-route --data strip_path=false
curl -s $PROXY/anything/test | jq .url
# strip_path=true (default): upstream receives /test -> httpbin 404
curl -s -X PATCH $ADMIN/routes/orders-route --data strip_path=true
curl -i $PROXY/anything/test
Keep in mind: strip_path removes the matched route path prefix before forwarding. It is the number-one cause of unexpected upstream 404s.
Lab 4 – Host-based routing
Task: Only requests with Host: api.example.com should be routed to orders-svc; requests with any other Host must return 404.
UI: Route → Edit → Hosts = api.example.com.
curl -s -X PATCH $ADMIN/routes/orders-route --data 'hosts[]=api.example.com'
curl -i -H 'Host: api.example.com' $PROXY/anything/x # 200
curl -i $PROXY/anything/x # 404 no Route matched
Keep in mind: wildcard hosts are allowed (*.example.com, api.*). The Host header must be sent when testing against localhost. When PATCHing arrays with form data, you replace the whole list.
Lab 5 – Method-based routing
Task: Route should accept only GET and POST.
UI: Route → Methods → select GET, POST.
curl -s -X PATCH $ADMIN/routes/orders-route \
--data 'methods[]=GET' --data 'methods[]=POST'
curl -i -X GET $PROXY/anything/x # 200
curl -i -X DELETE $PROXY/anything/x # 404 (Kong returns 404, not 405)
Keep in mind: a non-matching method gives 404 no Route matched, which fools many candidates into hunting for a path problem.
Lab 6 – Header-based routing (versioning)
Task: Create route-v2 on path /anything that matches only when header x-api-version: v2 is present, forwarding to a second service orders-v2 (http://httpbin.org/anything/v2).
curl -s -X POST $ADMIN/services --data name=orders-v2 --data url=http://httpbin.org/anything/v2
curl -s -X POST $ADMIN/services/orders-v2/routes \
--data name=route-v2 \
--data 'paths[]=/anything' \
--data 'headers.x-api-version=v2'
curl -s -H 'x-api-version: v2' $PROXY/anything/hi | jq .url
Verify: with the header the URL contains /anything/v2/...; without it the request falls through to another matching route.
Keep in mind: routes with more matching criteria are evaluated first (host + method + header + path beats path alone). Header names are case-insensitive; the Host header cannot be used here – use hosts.
Lab 7 – Regex path and regex_priority
Task: /users/<digits> must be matched by a regex route; /users/me by a plain route.
curl -s -X POST $ADMIN/services/orders-svc/routes \
--data name=users-id \
--data 'paths[]=~/users/(?<id>\d+)$' \
--data regex_priority=10
UI: Paths field → enter ~/users/(?<id>\d+)$ (the leading ~ marks a regex).
Verify: curl -i $PROXY/users/42 (matches) vs $PROXY/users/abc (404).
Keep in mind: a regex path must start with ~. Higher regex_priority wins when several regex routes could match. Escape \d carefully in the shell (single quotes).
Lab 8 – Overlapping routes: which one wins?
Task: /api → svc-a and /api/v2 → svc-b. Predict and prove the routing of /api/v2/items and /api/v1/items.
curl -s -X POST $ADMIN/services --data name=svc-a --data url=http://httpbin.org/anything/A
curl -s -X POST $ADMIN/services --data name=svc-b --data url=http://httpbin.org/anything/B
curl -s -X POST $ADMIN/services/svc-a/routes --data name=r-a --data 'paths[]=/api'
curl -s -X POST $ADMIN/services/svc-b/routes --data name=r-b --data 'paths[]=/api/v2'
curl -s $PROXY/api/v2/items | jq .url # .../anything/B/items
curl -s $PROXY/api/v1/items | jq .url # .../anything/A/v1/items
Keep in mind: among plain prefix paths the longest matching prefix wins. Two routes with the same criteria and same path are rejected (unique constraint/conflict).
Lab 9 – preserve_host
Task: The upstream must receive the original client Host header (api.example.com), not httpbin.org.
curl -s -X PATCH $ADMIN/routes/orders-route \
--data preserve_host=true --data 'hosts[]=api.example.com'
curl -s -H 'Host: api.example.com' $PROXY/anything/headers | jq '.headers.Host'
Verify: with preserve_host=false (default) httpbin reports httpbin.org; with true it reports api.example.com.
Keep in mind: needed for virtual-hosted upstreams and some SNI/host checks. UI: Route → Preserve Host toggle.
Lab 10 – Service path + route path concatenation
Task: Service URL http://httpbin.org/anything, route path /v1. Predict what the upstream sees for GET /v1/foo/bar.
curl -s -X POST $ADMIN/services --data name=v1-svc --data url=http://httpbin.org/anything
curl -s -X POST $ADMIN/services/v1-svc/routes --data name=v1-route --data 'paths[]=/v1'
curl -s $PROXY/v1/foo/bar | jq .url
Answer: http://.../anything/foo/bar → service.path + (request path minus stripped route prefix). With strip_path=false it would be /anything/v1/foo/bar.
Lab 11 – Timeouts and retries
Task: Make Kong give up after 1 s of upstream silence, with no retries, and prove it.
UI: Service → Edit → Advanced fields: Connect/Write/Read timeout 1000, Retries 0.
curl -s -X PATCH $ADMIN/services/orders-svc \
--data connect_timeout=1000 --data write_timeout=1000 \
--data read_timeout=1000 --data retries=0
time curl -i $PROXY/anything/../delay/5 # route must match, see keep-in-mind
Simpler: point a service at http://httpbin.org/delay/5 and call its route.
Verify: 504 The upstream server is timing out after ~1 s. A connection refused target gives 502; unresolvable DNS gives 503.
Keep in mind: values are in milliseconds; defaults are 60000 ms and 5 retries.
Lab 12 – Disable entities and use tags
Task: Tag the route exam, filter by tag, then disable the service temporarily.
curl -s -X PATCH $ADMIN/routes/orders-route --data 'tags[]=exam' --data 'tags[]=lab12'
curl -s "$ADMIN/routes?tags=exam" | jq '.data[].name'
curl -s -X PATCH $ADMIN/services/orders-svc --data enabled=false
curl -i $PROXY/anything/x # 503 or 404 depending on version
curl -s -X PATCH $ADMIN/services/orders-svc --data enabled=true
Keep in mind: tags=a,b means AND, tags=a/b means OR. Tags are also how decK scopes --select-tag.