Part G – Configuration Management, Admin and Operations
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.
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.
Lab 45 – Declarative config with decK
Task: Export the current config, add a service in YAML, preview and apply it.
deck gateway ping --kong-addr $ADMIN
deck gateway dump -o kong.yaml --kong-addr $ADMIN # older decK: deck dump
kong.yaml (add to the file):
_format_version: "3.0"
services:
- name: deck-svc
url: http://httpbin.org
routes:
- name: deck-route
paths: [/deck]
plugins:
- name: rate-limiting
config: { minute: 3, policy: local }
deck gateway validate kong.yaml
deck gateway diff kong.yaml --kong-addr $ADMIN # preview (+ create, ~ update, - delete)
deck gateway sync kong.yaml --kong-addr $ADMIN # apply
curl -i $PROXY/deck/get
Keep in mind: sync deletes anything not in the file – always run diff first or use --select-tag to limit scope. Use --workspace team-a for EE workspaces and --headers 'Kong-Admin-Token:xxx' when RBAC is on.
Lab 46 – DB-less mode
Task: Run Kong without a database from a kong.yml, then change config.
export KONG_DATABASE=off
export KONG_DECLARATIVE_CONFIG=/etc/kong/kong.yml
kong config parse /etc/kong/kong.yml # syntax/schema validation
kong start # or: kong reload after edits
curl -i -X POST $ADMIN/services --data name=x --data url=http://a.b # 405 – read-only
curl -s -X POST $ADMIN/config -F config=@/etc/kong/kong.yml # hot-load new config
curl -s $ADMIN/config | jq -r .config | head
Keep in mind: in DB-less mode there are no consumers’ runtime changes, no cluster-policy rate-limiting and no plugins that write to the DB (e.g. OAuth2 token issuing). A bad kong.yml is rejected with a 400 and the old config keeps running.
Lab 47 – Workspaces [EE]
Task: Create workspace team-a, add a service there and prove isolation.
UI: Overview → New Workspace team-a → enter it → Gateway Services → New.
curl -s -X POST $ADMIN/workspaces --data name=team-a
curl -s -X POST $ADMIN/team-a/services --data name=svc-a --data url=http://httpbin.org
curl -s -X POST $ADMIN/team-a/services/svc-a/routes --data name=r-a --data 'paths[]=/ta'
curl -s $ADMIN/services | jq '.data[].name' # default workspace: does not list svc-a
curl -s $ADMIN/team-a/services | jq '.data[].name'
Keep in mind: names are unique per workspace, but route paths/hosts must still not conflict across workspaces (proxy is shared). Deleting a workspace requires it to be empty. The URL pattern is /{workspace}/{entity}.
Lab 48 – RBAC [EE]
Task: A user ops1 may only read services in team-a.
# Enforce RBAC (kong.conf / env) then restart: KONG_ENFORCE_RBAC=on
curl -s -X POST $ADMIN/rbac/roles --data name=team-a-read -H 'Kong-Admin-Token: <super-admin>'
curl -s -X POST $ADMIN/rbac/roles/team-a-read/endpoints \
--data workspace=team-a --data endpoint=/services --data actions=read -H 'Kong-Admin-Token: <super-admin>'
curl -s -X POST $ADMIN/rbac/users --data name=ops1 --data user_token=ops1-token -H 'Kong-Admin-Token: <super-admin>'
curl -s -X POST $ADMIN/rbac/users/ops1/roles --data roles=team-a-read -H 'Kong-Admin-Token: <super-admin>'
curl -i $ADMIN/team-a/services -H 'Kong-Admin-Token: ops1-token' # 200
curl -i -X POST $ADMIN/team-a/services -H 'Kong-Admin-Token: ops1-token' ... # 403
UI: Teams → RBAC Users/Roles → create role → add endpoint permission → assign to user. Kong Manager login uses an Admin (/admins), not just an RBAC user.
Keep in mind: endpoint=* + actions=read,create,update,delete = full access; negative permissions (negative=true) override positives. Wrong/missing token → 401; insufficient permission → 403.
Lab 49 – TLS: certificate, SNI and HTTPS-only routes
Task: Serve api.example.com over HTTPS with your own certificate, and force HTTP clients to upgrade.
curl -s -X POST $ADMIN/certificates \
-F cert=@api.crt -F key=@api.key -F 'snis[]=api.example.com'
curl -s -X PATCH $ADMIN/routes/orders-route \
--data 'protocols[]=https' --data 'hosts[]=api.example.com' \
--data https_redirect_status_code=301
curl -ik --resolve api.example.com:8443:127.0.0.1 https://api.example.com:8443/anything/x # 200
curl -i -H 'Host: api.example.com' http://localhost:8000/anything/x # 301/426
Verify cert in use: openssl s_client -connect localhost:8443 -servername api.example.com </dev/null | openssl x509 -noout -subject.
Keep in mind: the SNI must match the TLS server name, otherwise Kong serves its default self-signed cert. For upstream TLS use service.protocol=https and, for mTLS, client_certificate, tls_verify, ca_certificates.
Lab 50 – Hybrid mode: Control Plane and Data Plane
Task: Start a CP with a DB and a DP without one; prove config propagates.
kong hybrid gen_cert cluster.crt cluster.key # shared mTLS pair (or use a CA)
# Control plane
KONG_ROLE=control_plane KONG_DATABASE=postgres KONG_CLUSTER_CERT=cluster.crt \
KONG_CLUSTER_CERT_KEY=cluster.key KONG_CLUSTER_LISTEN=0.0.0.0:8005 \
KONG_CLUSTER_TELEMETRY_LISTEN=0.0.0.0:8006 kong start
# Data plane
KONG_ROLE=data_plane KONG_DATABASE=off KONG_CLUSTER_CONTROL_PLANE=cp:8005 \
KONG_CLUSTER_TELEMETRY_ENDPOINT=cp:8006 KONG_CLUSTER_CERT=cluster.crt \
KONG_CLUSTER_CERT_KEY=cluster.key kong start
curl -s $ADMIN/clustering/data-planes | jq '.data[]|{hostname,ip,status:.sync_status}'
UI: Kong Manager → Data Plane Nodes (shows connected DPs and last-seen).
Keep in mind: configure services/routes only on the CP Admin API; the DP proxies traffic and has no Admin API for writes. Rate-limiting policy=cluster is not supported on DPs – use local or redis. DPs keep serving the last known config if the CP is down.
Lab 51 – Kong CLI and configuration precedence
Task: Move the proxy to port 9000 and enable debug logging, using an environment variable, then verify.
kong version
kong check /etc/kong/kong.conf # validate kong.conf
KONG_PROXY_LISTEN=0.0.0.0:9000 KONG_LOG_LEVEL=debug kong reload
ss -ltnp | grep 9000
curl -s $ADMIN/ | jq '.configuration.proxy_listen, .configuration.log_level'
kong stop # fast shutdown; kong quit = graceful
Keep in mind: precedence is environment variable KONG_* > kong.conf > defaults. kong reload re-reads config without dropping connections; a plain edit of kong.conf has no effect until reload/restart. Prefix dir default /usr/local/kong.
Lab 52 – Systematic troubleshooting (404 / 502 / 503 / 504 / 500)
Task: Given a failing request, find the root cause in under two minutes.
| Symptom | Most likely cause | Quick check / fix |
|---|---|---|
404 no Route matched with those values | Path, host, method, header or protocol mismatch; wrong strip_path | GET /routes, curl -v with correct Host |
404 from the upstream body (not Kong JSON) | Route matched, upstream path wrong | strip_path, service.path, curl upstream directly |
502 An invalid response was received from the upstream server | Upstream down, port wrong, TLS mismatch (http vs https) | service.protocol/port, curl upstream from the Kong host |
503 name resolution failed / failure to get a peer from the balancer | Bad DNS name, no healthy targets, service host not equal to upstream name | /upstreams/<n>/health, DNS inside the container |
504 The upstream server is timing out | Slow upstream vs read_timeout | Raise timeouts / fix upstream |
500 An unexpected error occurred | Plugin config / Lua error | error.log at notice/debug |
401 / 403 | Auth / ACL / IP plugin | Lab 27 |
429 | Rate limit | Check RateLimit-* headers and plugin scope |
docker exec kong tail -n 50 /usr/local/kong/logs/error.log
curl -sv $PROXY/anything/x 2>&1 | grep -E '^< (HTTP|X-Kong|Via)'
Keep in mind: the headers X-Kong-Upstream-Latency (present = Kong reached the upstream) vs absent (Kong never got a response) separate route/auth problems from upstream problems.
Lab 53 – Database migrations (install and upgrade)
Task: Prepare a fresh Postgres and later upgrade Kong with minimal downtime.
kong migrations bootstrap -c kong.conf # fresh install only
kong migrations list # which are executed / pending
# Upgrade 3.x -> 3.y
kong migrations up # non-breaking, old nodes keep running
# roll out new Kong nodes ...
kong migrations finish # completes breaking changes
Keep in mind: bootstrap on an already-initialised DB fails; Kong refuses to start if migrations are pending (database needs updating). Kong 3.x supports PostgreSQL only (Cassandra removed). Take a DB backup first.
Lab 54 – Mini mock exam (45 minutes)
Do all of this from scratch, with evidence for each item (a curl -i output or Admin API GET):
- Create
shop-svc→http://httpbin.org, route/shop,strip_path=false; prove with/shop/anythingor/anything. - Create upstream
shop-upwith two targets, weights 70/30, service host =shop-up. - Add active health check on
/status/200every 5 s; stop one target and showUNHEALTHY. - Add
key-authon the service, consumersu1andu2, custom headerX-API-Key,hide_credentials=true. - Add
aclallowing only groupvip;u1invip,u2not → 200 vs 403. - Add
rate-limiting3/min on the route;u1gets 10/min via a consumer-scoped plugin. - Add
request-transformeraddingX-Source: examandresponse-transformeraddingX-Lab: done. - Add
correlation-idandfile-logand show one JSON log line containing the request id. - Export everything with
deck gateway dumpand show that adiffagainst a clean node would recreate it. - Break something on purpose (wrong service port) and diagnose it with status code +
error.log.
Exam-day strategy
- Read the exact entity names and values in the task (route name, header name, port). A typo = a failed check.
- Always verify with
curl -iafter every change and keep the command history (history) – it proves the work. - Check scope first: service vs route vs consumer vs global; most “plugin not working” tasks are scope mistakes.
- Remember the defaults:
strip_path=true,preserve_host=false, timeouts 60 s, retries 5, upstream weight 100,limit_by=consumer,policy=localis not shared between nodes. - Know both interfaces: Kong Manager for quick visual tasks, Admin API/decK for repeatable ones; field names are the same in both (
config.minute= Minute field in the UI). - 404 = route problem, 401/403 = auth problem, 502/503/504 = upstream problem. Start there.
- Time-box: if a task takes > 5 minutes, move on and return later.
- Practise with the official docs open (docs.konghq.com plugin pages list every parameter and default) – learn where parameters are documented rather than memorising everything.