The Kong Gateway Certified Associate exam features 14 hands-on lab scenarios where candidates utilize a hybrid approach combining the Kong Manager UI and the Command-Line Interface. While 70% to 80% of configuration tasks—such as routing, authentication, and rate-limiting—are executed faster in the Kong Manager UI, declarative state management and node diagnostics strictly require the CLI and tools like decK. Success in the 2-hour performance-based exam depends on selecting the optimal tool for each specific traffic, security, or troubleshooting scenario. You can read the full introductory article at Kong.
Kong Gateway Associate: 14 Hands-On Lab Scenarios
Lets discuss this in detail.
Default ports (memorise these):
| Port | Purpose |
|---|---|
| 8000 / 8443 | Proxy (HTTP / HTTPS) |
| 8001 / 8444 | Admin API (HTTP / HTTPS) |
| 8002 / 8445 | Kong Manager (UI) |
Lab setup (Docker, Postgres)
docker network create kong-net
docker run -d --name kong-db --network kong-net \
-e POSTGRES_USER=kong -e POSTGRES_DB=kong -e POSTGRES_PASSWORD=kongpass postgres:13
docker run --rm --network kong-net \
-e KONG_DATABASE=postgres -e KONG_PG_HOST=kong-db -e KONG_PG_PASSWORD=kongpass \
kong/kong-gateway:latest kong migrations bootstrap
docker run -d --name kong --network kong-net \
-e KONG_DATABASE=postgres -e KONG_PG_HOST=kong-db -e KONG_PG_PASSWORD=kongpass \
-e KONG_ADMIN_LISTEN=0.0.0.0:8001 -e KONG_ADMIN_GUI_URL=http://localhost:8002 \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8002:8002 \
kong/kong-gateway:latest
Pin a specific image tag in a real lab. Workspaces (Lab 11) need an Enterprise licence, and some Enterprise-only features may not work without one.
Lab 1: Create a Service and a Route
Task: Proxy requests from /httpbin to http://httpbin.org.
UI: Kong Manager → Workspace default → Gateway Services → New Gateway Service (Name httpbin-svc, Full URL http://httpbin.org) → open the service → Routes → Add Route (Name httpbin-route, Path /httpbin).
CLI:
curl -i -X POST http://localhost:8001/services \
--data name=httpbin-svc --data url=http://httpbin.org
curl -i -X POST http://localhost:8001/services/httpbin-svc/routes \
--data name=httpbin-route --data 'paths[]=/httpbin'
Verify:
curl -i http://localhost:8000/httpbin/get
Instructor notes:
- A Service is where the upstream lives. A Route is how clients reach it.
strip_path=trueis the default, so/httpbin/getreaches the upstream as/get.- A service can have many routes, but a route belongs to exactly one service.
- Setting
urlon a service auto-fillsprotocol,host,portandpath.
Lab 2: Advanced route matching (host, method, strip_path)
Task: Only GET requests with Host: api.example.com and path /orders should reach the service. The upstream expects /orders untouched.
UI: Routes → New Route → Hosts api.example.com, Methods GET, Paths /orders, toggle Strip Path off.
CLI:
curl -i -X POST http://localhost:8001/services/httpbin-svc/routes \
--data name=orders-route \
--data 'hosts[]=api.example.com' \
--data 'methods[]=GET' \
--data 'paths[]=/orders' \
--data strip_path=false
Verify:
curl -i http://localhost:8000/orders -H 'Host: api.example.com' # reaches upstream
curl -i -X POST http://localhost:8000/orders -H 'Host: api.example.com' # 404
Instructor notes:
- A request must satisfy all populated route fields (AND logic). Values within one field are OR.
- The failure message is
{"message":"no Route matched with those values"}. - Kong picks the most specific match. Longer paths and regex paths take priority, and a route with hosts beats one without.
strip_path=falseis a classic exam trap when the upstream expects the full path.
Lab 3: Key authentication with a Consumer
Task: Protect httpbin-route so only consumer alice, with key alice-secret, can call it.
UI: Plugins → New Plugin → Key Authentication → scope: Route httpbin-route → Create. Then Consumers → New Consumer (alice) → Credentials → New Key Auth Credential → Key alice-secret.
CLI:
curl -i -X POST http://localhost:8001/routes/httpbin-route/plugins --data name=key-auth
curl -i -X POST http://localhost:8001/consumers --data username=alice
curl -i -X POST http://localhost:8001/consumers/alice/key-auth --data key=alice-secret
Verify:
curl -i http://localhost:8000/httpbin/get # 401
curl -i http://localhost:8000/httpbin/get -H 'apikey: alice-secret' # 200
curl -i http://localhost:8000/httpbin/get -H 'apikey: wrong' # 401
Instructor notes:
- A missing key returns
401 No API key found in request. A wrong key returns401 Invalid authentication credentials. - The default
key_namesis["apikey"], and it accepts the key in a header or query string. config.hide_credentials=truestops Kong forwarding the key to the upstream.- If you create the plugin but no consumer or credential, every request gets 401. Expect questions about this.
Lab 4: Rate limiting, global default plus consumer override
Task: Limit all traffic on the route to 5 requests per minute. Let alice have 20 per minute.
UI: Plugins → Rate Limiting → scope Route → minute = 5, policy = local. Then add another Rate Limiting plugin scoped to Consumer alice with minute = 20.
CLI:
curl -i -X POST http://localhost:8001/routes/httpbin-route/plugins \
--data name=rate-limiting --data config.minute=5 --data config.policy=local
curl -i -X POST http://localhost:8001/consumers/alice/plugins \
--data name=rate-limiting --data config.minute=20 --data config.policy=local
Verify:
for i in {1..7}; do curl -s -o /dev/null -w "%{http_code}\n" \
http://localhost:8000/httpbin/get -H 'apikey: alice-secret'; done
Check the X-RateLimit-Remaining-Minute header. The 429 body is API rate limit exceeded.
Instructor notes:
- Policies:
local(per node, fastest),cluster(shared via the database, slower),redis(shared, best for multi-node). - Rate limiting by consumer only works when an auth plugin identifies the consumer. Otherwise it limits by IP (
limit_by). - The consumer-scoped plugin overrides the route-scoped one (see Lab 10).
Lab 5: ACL with groups
Task: Only consumers in group admins can access /admin. bob (group users) must get 403.
CLI:
curl -X POST http://localhost:8001/services/httpbin-svc/routes \
--data name=admin-route --data 'paths[]=/admin'
curl -X POST http://localhost:8001/routes/admin-route/plugins --data name=key-auth
curl -X POST http://localhost:8001/routes/admin-route/plugins \
--data name=acl --data 'config.allow[]=admins'
curl -X POST http://localhost:8001/consumers --data username=bob
curl -X POST http://localhost:8001/consumers/bob/key-auth --data key=bob-secret
curl -X POST http://localhost:8001/consumers/alice/acls --data group=admins
curl -X POST http://localhost:8001/consumers/bob/acls --data group=users
UI: Consumer → Groups / ACLs → Add. Route → Plugins → ACL → Allow list.
Verify: alice returns 200. bob returns 403 You cannot consume this service.
Instructor notes:
- ACL needs an authentication plugin first, since it must know who the consumer is. Without one, you get
401/403errors. - Use
allowordeny, not both.
Lab 6: Upstream, targets and load balancing
Task: Balance traffic across two backends and mark unhealthy nodes.
docker run -d --name app1 --network kong-net kennethreitz/httpbin
docker run -d --name app2 --network kong-net kennethreitz/httpbin
CLI:
curl -X POST http://localhost:8001/upstreams --data name=orders-upstream
curl -X POST http://localhost:8001/upstreams/orders-upstream/targets --data target=app1:80 --data weight=100
curl -X POST http://localhost:8001/upstreams/orders-upstream/targets --data target=app2:80 --data weight=100
# point a service at the upstream NAME
curl -X POST http://localhost:8001/services \
--data name=lb-svc --data host=orders-upstream --data port=80
curl -X POST http://localhost:8001/services/lb-svc/routes \
--data name=lb-route --data 'paths[]=/lb'
# active health checks
curl -X PATCH http://localhost:8001/upstreams/orders-upstream \
--data healthchecks.active.http_path=/status/200 \
--data healthchecks.active.healthy.interval=5 \
--data healthchecks.active.unhealthy.interval=5 \
--data healthchecks.active.unhealthy.http_failures=2
UI: Upstreams → New Upstream → open it → Targets → New Target. Set the service Host to the upstream name.
Verify:
curl http://localhost:8001/upstreams/orders-upstream/health
docker stop app2 # after a few seconds, app2 shows UNHEALTHY and traffic goes only to app1
Instructor notes:
- The service host must equal the upstream name to get load balancing.
- Algorithms:
round-robin(default),consistent-hashing,least-connections,latency. - Active checks use probes. Passive checks watch real traffic and can only mark targets unhealthy, not recover them.
- If all targets are unhealthy, Kong returns
503 failure to get a peer from the load balancer.
Lab 7: Request and response transformation
Task: Add X-Source: kong to upstream requests, remove the User-Agent header, and add X-Powered-By: Kong to responses.
curl -X POST http://localhost:8001/routes/httpbin-route/plugins \
--data name=request-transformer \
--data 'config.add.headers[]=X-Source:kong' \
--data 'config.remove.headers[]=User-Agent'
curl -X POST http://localhost:8001/routes/httpbin-route/plugins \
--data name=response-transformer \
--data 'config.add.headers[]=X-Powered-By:Kong'
Verify:
curl -i http://localhost:8000/httpbin/headers -H 'apikey: alice-secret'
The upstream body shows X-Source, and the response headers show X-Powered-By.
Instructor notes:
- Request transformer changes what the upstream sees. Response transformer changes what the client sees.
- The order is: remove, rename, replace, add, append.
- The format is
name:value, and the array syntax in curl needs[].
Lab 8: CORS
Task: Allow https://app.example.com to call the API with GET and POST, including credentials.
curl -X POST http://localhost:8001/services/httpbin-svc/plugins \
--data name=cors \
--data 'config.origins[]=https://app.example.com' \
--data 'config.methods[]=GET' --data 'config.methods[]=POST' \
--data 'config.headers[]=Authorization' --data 'config.headers[]=Content-Type' \
--data config.credentials=true --data config.max_age=3600
Verify (preflight):
curl -i -X OPTIONS http://localhost:8000/httpbin/get \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: GET'
Look for Access-Control-Allow-Origin: https://app.example.com.
Instructor notes: Browsers reject * as the allowed origin when credentials are enabled, so list explicit origins. Kong answers preflight itself, and preflight_continue forwards it to the upstream instead.
Lab 9: IP restriction
Task: Allow only 10.0.0.0/8 to access /admin.
curl -X POST http://localhost:8001/routes/admin-route/plugins \
--data name=ip-restriction --data 'config.allow[]=10.0.0.0/8'
Verify: Your request is blocked with 403 Your IP address is not allowed.
Instructor notes:
- Behind a load balancer, Kong sees the LB’s IP unless you set
trusted_ipsandreal_ip_header=X-Forwarded-Forinkong.conf(or the matchingKONG_environment variables). Then restart or reload. - Allow and deny can’t be mixed incorrectly. Allow wins as a whitelist.
Lab 10: Plugin scope and precedence
Task: A global rate limit is 100/min. /httpbin must be limited to 5/min. Prove which one applies.
curl -X POST http://localhost:8001/plugins \
--data name=rate-limiting --data config.minute=100
# route-level plugin from Lab 4 (5/min) already exists
curl -i http://localhost:8000/httpbin/get -H 'apikey: alice-secret'
Check X-RateLimit-Limit-Minute. The most specific plugin wins.
Instructor notes:
- Scopes: Global, Service, Route, Consumer, and combinations of them.
- Only one instance of a given plugin runs per request. The most specific one wins, with Consumer + Route + Service at the top and Global at the bottom.
- Disable without deleting:
curl -X PATCH http://localhost:8001/plugins/{id} --data enabled=false - Use
GET /pluginsandGET /routes/{name}/pluginsto audit what’s attached.
Lab 11: Workspaces (Enterprise)
Task: Create workspace team-a and add a service inside it that doesn’t appear in default.
curl -X POST http://localhost:8001/workspaces --data name=team-a
curl -X POST http://localhost:8001/team-a/services --data name=hello --data url=http://httpbin.org
curl http://localhost:8001/default/services # does NOT list "hello"
UI: Kong Manager home → Workspaces → New Workspace. Click into it to see isolated entities.
Instructor notes: The workspace name prefixes Admin API paths. Entities such as services and routes are isolated per workspace, so the same service name can exist in two workspaces. Don’t assume default unless the question says so.
Lab 12: Declarative config, decK and DB-less mode
Task A (decK): Export current config, change it, and apply it.
deck gateway dump -o kong.yaml # older decK versions: deck dump
# edit kong.yaml, e.g. change rate-limiting minute: 5 -> 10
deck gateway diff -s kong.yaml
deck gateway sync -s kong.yaml
Task B (DB-less):
# kong.yml
_format_version: "3.0"
services:
- name: httpbin-svc
url: http://httpbin.org
routes:
- name: httpbin-route
paths: [/httpbin]
docker run -d --name kong-dbless \
-e KONG_DATABASE=off -e KONG_DECLARATIVE_CONFIG=/kong/kong.yml \
-e KONG_ADMIN_LISTEN=0.0.0.0:8001 \
-v $(pwd)/kong.yml:/kong/kong.yml -p 8000:8000 -p 8001:8001 \
kong/kong-gateway:latest
kong config parse kong.yml # validate syntax
curl -X POST http://localhost:8001/config -F config=@kong.yml # reload at runtime
Instructor notes:
- In DB-less mode the Admin API is read-only except
/config. NoPOST /services. _format_versionis mandatory.deck diffis a safe preview, anddeck syncmakes the gateway match the file exactly, including deleting extras.
Lab 13: Logging and request tracing
Task: Log every request to a file and add a correlation ID.
curl -X POST http://localhost:8001/routes/httpbin-route/plugins \
--data name=file-log --data config.path=/tmp/kong-requests.log
curl -X POST http://localhost:8001/routes/httpbin-route/plugins \
--data name=correlation-id --data config.header_name=X-Request-ID \
--data config.generator=uuid --data config.echo_downstream=true
curl -i http://localhost:8000/httpbin/get -H 'apikey: alice-secret'
docker exec kong tail -n 1 /tmp/kong-requests.log
Notice the X-Request-ID response header, and the log JSON containing the route, service, consumer, latencies and the request ID.
Instructor notes: In the log, latencies.kong is Kong’s own processing time, latencies.proxy is the upstream time, and latencies.request is the total.
Lab 14: Troubleshooting
Task: Match each symptom to the cause and fix.
| Symptom | Likely cause | How to confirm and fix |
|---|---|---|
404 no Route matched with those values | Path, host or method mismatch | GET /routes. Check paths, hosts, methods, strip_path. |
401 No API key found | Auth plugin on, no credential sent | Send apikey. Check key_names. |
403 You cannot consume this service | ACL group mismatch | GET /consumers/{c}/acls |
429 API rate limit exceeded | Rate limit hit | Check X-RateLimit-* headers and the plugin config. |
502 An invalid response was received from the upstream server | Upstream unreachable, or it sent bad data | Test the upstream directly from inside the Kong container. |
503 failure to get a peer from the load balancer | All targets unhealthy, or no targets | GET /upstreams/{u}/health |
504 | Upstream timeout | Raise service read_timeout, connect_timeout and write_timeout. |
name resolution failed | DNS cannot resolve the service host | Check the Docker network and the hostname spelling. |
Useful commands:
curl http://localhost:8001/status
curl http://localhost:8001/services
kong health
kong check /etc/kong/kong.conf
kong reload
docker logs kong --tail 50
Exam-day tips from your instructor
- Use the Admin API for speed and the UI for checking. Know both, because tasks may specify either.
- Read the scope carefully. Is the plugin for the Service, the Route, a Consumer or Global? Wrong scope is the most common failed task.
- Know the HTTP verbs:
POSTcreates,PATCHupdates part of an entity,PUTcreates or fully replaces,DELETEremoves. - Always test with curl after configuring. Check status codes, not just that “it saved”.
- Remember the error messages. They tell you which plugin or entity is at fault.
- Authentication before authorisation: key-auth first, then ACL.
- Entities can be referenced by name or UUID in Admin API paths.