Kong Gateway Certified Associate – Lab Exam Command-Line Guide
Prepared for RD. A practical, command-first study guide for the hands-on section.
Check the format before you sit it. Kong’s public material describes the exam as multiple choice plus performance-based tasks, with a 75% pass mark, and earlier bootcamps described it as open book. Exact timing and lab tasks can change, so confirm on the Kong Academy exam-preparation page and your TrueAbility booking. Kong’s official prep points to three learning labs: KGLL-101 (Services, Routes, Plugins, Consumers), KGLL-103 (Logging and metrics) and KGLL-106 (Canary deployments). Treat this guide as a skills checklist, not a leaked question bank.
1. How to use this guide
- Work through each article with a real Kong Gateway running locally (Docker Compose is fine).
- For every task, do it three ways: Admin API (curl), decK (declarative YAML), and Kong Manager (UI). The exam may constrain which you can use.
- After each change, prove it works with a request through the proxy port (8000), not just a 201 from the Admin API (8001).
- Practise the lab tasks in Section 13 under a timer.
2. Core concepts you must be able to explain
- Request flow: client → proxy listener (8000/8443) → route match (hosts, paths, methods, headers) → plugins run in phases (access, header_filter, body_filter, log) → upstream/service → response back through the plugins.
- Entities: Service (the upstream API), Route (how requests are matched), Consumer (an API client identity), Plugin (behaviour attached at a scope), Upstream and Target (load balancing), Certificate and SNI, Workspace (Enterprise multi-tenancy).
- Plugin scopes and precedence: a plugin can be global, or attached to a service, route, consumer, or combinations such as route plus consumer. The most specific combination wins; only one instance of a given plugin runs per request. Know the order: consumer+route+service, consumer+route, consumer+service, route+service, consumer, route, service, global.
- Default ports: 8000 HTTP proxy, 8443 HTTPS proxy, 8001 Admin API HTTP, 8444 Admin API HTTPS, 8002 Kong Manager, 8445 Kong Manager HTTPS, 8003 Dev Portal, 8004 Dev Portal GUI HTTPS variants depend on version. Verify with
kong configorkong.confon your build. - Deployment modes: traditional (database), DB-less (declarative file), hybrid (control plane and data planes). Know which Admin API operations are read-only in DB-less mode.
3. Article: Installing and starting Kong
3.1 Docker, database mode
docker network create kong-net
docker run -d --name kong-database --network kong-net \
-e POSTGRES_USER=kong -e POSTGRES_DB=kong -e POSTGRES_PASSWORD=kongpass \
postgres:13
# bootstrap the schema (run once)
docker run --rm --network kong-net \
-e KONG_DATABASE=postgres -e KONG_PG_HOST=kong-database \
-e KONG_PG_USER=kong -e KONG_PG_PASSWORD=kongpass \
kong/kong-gateway:3.4 kong migrations bootstrap
docker run -d --name kong --network kong-net \
-e KONG_DATABASE=postgres -e KONG_PG_HOST=kong-database \
-e KONG_PG_USER=kong -e KONG_PG_PASSWORD=kongpass \
-e KONG_PROXY_ACCESS_LOG=/dev/stdout -e KONG_ADMIN_ACCESS_LOG=/dev/stdout \
-e KONG_PROXY_ERROR_LOG=/dev/stderr -e KONG_ADMIN_ERROR_LOG=/dev/stderr \
-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 8444:8444 -p 8002:8002 \
kong/kong-gateway:3.4
3.2 Docker, DB-less mode
docker run -d --name kong-dbless \
-e KONG_DATABASE=off \
-e KONG_DECLARATIVE_CONFIG=/kong/declarative/kong.yml \
-v $(pwd)/kong.yml:/kong/declarative/kong.yml \
-e KONG_ADMIN_LISTEN=0.0.0.0:8001 \
-p 8000:8000 -p 8001:8001 kong/kong-gateway:3.4
3.3 Verify
curl -s localhost:8001/ | jq '.version, .configuration.database'
curl -s localhost:8001/status | jq
curl -i localhost:8000 # 404 "no Route matched" is the healthy empty state
3.4 The kong CLI inside the container
docker exec -it kong kong version
docker exec -it kong kong health # checks the running node
docker exec -it kong kong check /etc/kong/kong.conf
docker exec -it kong kong reload # graceful config reload
docker exec -it kong kong stop
docker exec -it kong kong migrations list # pending/executed migrations
docker exec -it kong kong migrations up # then: kong migrations finish
Exam tip: configuration can be given as kong.conf keys or as environment variables prefixed KONG_ in upper case (proxy_listen becomes KONG_PROXY_LISTEN).
4. Article: Admin API essentials
The Admin API is RESTful. Use POST to create, PUT to create or replace by id/name, PATCH to update, DELETE to remove, GET to list or read.
export ADMIN=http://localhost:8001
# Inspect
curl -s $ADMIN/services | jq '.data[].name'
curl -s $ADMIN/routes | jq '.data[] | {name, paths, service}'
curl -s $ADMIN/plugins | jq '.data[] | {name, enabled, service, route, consumer}'
# Pagination and filtering
curl -s "$ADMIN/services?size=5"
curl -s "$ADMIN/routes?tags=lab1"
# Tags help you find and bulk-manage your lab objects
curl -s -X POST $ADMIN/services --data name=demo --data url=http://httpbin.org --data tags=lab1
Useful discovery endpoints: /status, /endpoints, /schemas/plugins/<name>, /plugins/enabled, /config (DB-less export), /cache/<key>.
curl -s $ADMIN/plugins/enabled | jq
curl -s $ADMIN/schemas/plugins/rate-limiting | jq '.fields[].config.fields'
Because the exam may be open book, learn to read the plugin schema quickly: it tells you every allowed field and default.
5. Article: Services, Routes and proxying (KGLL-101 core)
5.1 Create a Service and a Route
curl -i -X POST $ADMIN/services \
--data name=example_service \
--data url=http://httpbin.org
curl -i -X POST $ADMIN/services/example_service/routes \
--data name=example_route \
--data 'paths[]=/mock' \
--data 'hosts[]=api.example.com'
curl -i http://localhost:8000/mock/anything -H 'Host: api.example.com'
You can also define a service by parts: --data protocol=https --data host=httpbin.org --data port=443 --data path=/anything.
5.2 Route matching knobs you need to know
paths,hosts,methods,headers,snis,sources/destinations(stream),protocols.strip_path(default true):/mock/anythingbecomes/anythingupstream. Set--data strip_path=falseto keep the prefix.preserve_host(default false): whether the upstream sees the original Host header.regex_priorityand path length decide ties. Regex paths start with~, for example~/users/(?<id>\d+)$.
curl -i -X PATCH $ADMIN/routes/example_route --data strip_path=false
curl -i -X POST $ADMIN/services/example_service/routes \
--data name=get_only --data 'paths[]=/readonly' --data 'methods[]=GET'
5.3 Troubleshooting matrix
| Symptom | Likely cause |
|---|---|
404 no Route matched with those values | Path, host or method does not match any route |
502 An invalid response was received from the upstream server | Upstream unreachable or crashed |
503 name resolution failed or failure to get a peer from the ring-balancer | DNS failure or no healthy targets |
| 504 | Upstream timeout (read_timeout, connect_timeout, write_timeout) |
| 401 / 403 | Auth plugin or ACL rejecting the request |
| 429 | Rate limit exceeded |
5.4 Update and delete
curl -i -X PATCH $ADMIN/services/example_service --data retries=3 --data read_timeout=30000
curl -i -X DELETE $ADMIN/routes/get_only
# A service cannot be deleted while routes still reference it
6. Article: Plugins
6.1 Enable, scope, disable
# Global
curl -X POST $ADMIN/plugins --data name=correlation-id \
--data config.header_name=X-Request-ID --data config.generator=uuid
# Service scoped
curl -X POST $ADMIN/services/example_service/plugins \
--data name=rate-limiting --data config.minute=5 --data config.policy=local
# Route scoped
curl -X POST $ADMIN/routes/example_route/plugins \
--data name=request-transformer \
--data 'config.add.headers[]=X-From:kong'
# Disable without deleting
curl -X PATCH $ADMIN/plugins/<plugin-id> --data enabled=false
curl -X DELETE $ADMIN/plugins/<plugin-id>
Note the id: PATCH and DELETE use the plugin id, not the plugin name.
6.2 Rate limiting
curl -X POST $ADMIN/services/example_service/plugins \
--data name=rate-limiting \
--data config.minute=5 --data config.hour=100 \
--data config.limit_by=ip --data config.policy=local
for i in $(seq 1 7); do curl -s -o /dev/null -w '%{http_code}\n' localhost:8000/mock/anything; done
curl -i localhost:8000/mock/anything | grep -i ratelimit
Know the policies: local (per node, fast), cluster (database), redis (shared across nodes). Know limit_by: consumer, credential, ip, service, header, path. The Enterprise rate-limiting-advanced plugin adds sliding windows and multiple tiers.
6.2.1 Proxy caching
curl -X POST $ADMIN/routes/example_route/plugins \
--data name=proxy-cache --data config.strategy=memory \
--data config.cache_ttl=30 --data 'config.content_type[]=application/json'
# Check the X-Cache-Status response header: Miss, Hit, Bypass, Refresh
6.3 Request and response transformers
curl -X POST $ADMIN/routes/example_route/plugins --data name=request-transformer \
--data 'config.add.headers[]=X-Env:lab' --data 'config.remove.headers[]=User-Agent'
curl -X POST $ADMIN/routes/example_route/plugins --data name=response-transformer \
--data 'config.add.headers[]=X-Powered-By:Kong'
6.4 CORS, IP restriction, request size limiting, bot detection
curl -X POST $ADMIN/services/example_service/plugins --data name=cors \
--data 'config.origins[]=https://app.example.com' --data 'config.methods[]=GET' --data 'config.methods[]=POST'
curl -X POST $ADMIN/services/example_service/plugins --data name=ip-restriction \
--data 'config.allow[]=10.0.0.0/8'
curl -X POST $ADMIN/routes/example_route/plugins --data name=request-size-limiting \
--data config.allowed_payload_size=1
7. Article: Consumers and authentication
7.1 Key authentication
curl -X POST $ADMIN/services/example_service/plugins --data name=key-auth
# (optional) --data config.key_names=apikey
curl -i localhost:8000/mock/anything # 401 No API key found
curl -X POST $ADMIN/consumers --data username=alice
curl -X POST $ADMIN/consumers/alice/key-auth --data key=alice-secret
curl -i localhost:8000/mock/anything -H 'apikey: alice-secret' # 200
curl -i "localhost:8000/mock/anything?apikey=alice-secret" # query string also works by default
Defaults to remember: header or query parameter named apikey; config.hide_credentials=false; config.anonymous lets unauthenticated requests through as a named consumer.
7.2 Basic auth, HMAC, JWT, OAuth2, OIDC (concept level)
# Basic auth
curl -X POST $ADMIN/services/example_service/plugins --data name=basic-auth
curl -X POST $ADMIN/consumers/alice/basic-auth --data username=alice --data password=pass123
curl -i -u alice:pass123 localhost:8000/mock/anything
# JWT
curl -X POST $ADMIN/routes/example_route/plugins --data name=jwt
curl -X POST $ADMIN/consumers/alice/jwt --data algorithm=HS256 --data key=alice-iss --data secret=s3cr3t
# The token's iss claim must equal the credential key.
The openid-connect plugin is Enterprise. Be able to explain the difference between authentication (who are you) and authorization (what may you do).
7.3 ACL (authorization with groups)
curl -X POST $ADMIN/routes/example_route/plugins --data name=acl \
--data 'config.allow[]=gold'
curl -X POST $ADMIN/consumers/alice/acls --data group=gold
curl -X POST $ADMIN/consumers --data username=bob
curl -X POST $ADMIN/consumers/bob/key-auth --data key=bob-secret
# bob has no group: expect 403 "You cannot consume this service"
The ACL plugin needs an authentication plugin first, otherwise it cannot identify the consumer.
7.4 Per-consumer plugin configuration
curl -X POST $ADMIN/consumers/alice/plugins --data name=rate-limiting \
--data config.minute=100 --data config.policy=local
This consumer-scoped instance overrides the service-level one for alice. Practise proving it with a loop of requests for both consumers.
8. Article: Upstreams, targets, load balancing and health checks
curl -X POST $ADMIN/upstreams --data name=orders-upstream
curl -X POST $ADMIN/upstreams/orders-upstream/targets --data target=orders-v1:8080 --data weight=100
curl -X POST $ADMIN/upstreams/orders-upstream/targets --data target=orders-v2:8080 --data weight=100
# Point a service at the upstream by name
curl -X POST $ADMIN/services --data name=orders --data host=orders-upstream
curl -X POST $ADMIN/services/orders/routes --data name=orders-route --data 'paths[]=/orders'
Algorithms (--data algorithm=...): round-robin (default, weight-based), consistent-hashing (with hash_on header, cookie, path, consumer, ip), least-connections, latency (newer versions).
8.1 Health checks
curl -X PATCH $ADMIN/upstreams/orders-upstream \
--data config.healthchecks.active.http_path=/health \
--data config.healthchecks.active.healthy.interval=5 \
--data config.healthchecks.active.healthy.successes=2 \
--data config.healthchecks.active.unhealthy.interval=5 \
--data config.healthchecks.active.unhealthy.http_failures=2 \
--data config.healthchecks.passive.unhealthy.http_failures=3
Note: in some Admin API versions nested upstream fields are written as healthchecks.active... without the config. prefix. Check curl $ADMIN/upstreams/orders-upstream and use the exact field names it returns.
curl -s $ADMIN/upstreams/orders-upstream/health | jq
curl -X POST $ADMIN/upstreams/orders-upstream/targets/orders-v2:8080/unhealthy
curl -X POST $ADMIN/upstreams/orders-upstream/targets/orders-v2:8080/healthy
- Active checks probe the target on an interval. Passive (circuit breaker) checks observe real traffic. Passive checks cannot bring an unhealthy target back; only active checks or the Admin API can.
9. Article: Canary releases (KGLL-106)
Two approaches to know.
9.1 Weighted targets (works everywhere)
# 90/10 split between stable and canary
curl -X POST $ADMIN/upstreams --data name=app-upstream
curl -X POST $ADMIN/upstreams/app-upstream/targets --data target=app-stable:8080 --data weight=90
curl -X POST $ADMIN/upstreams/app-upstream/targets --data target=app-canary:8080 --data weight=10
# Shift traffic: add a new target entry with a new weight (the latest entry for a target wins)
curl -X POST $ADMIN/upstreams/app-upstream/targets --data target=app-canary:8080 --data weight=50
curl -X POST $ADMIN/upstreams/app-upstream/targets --data target=app-stable:8080 --data weight=50
# Roll back instantly
curl -X POST $ADMIN/upstreams/app-upstream/targets --data target=app-canary:8080 --data weight=0
Validate with a loop and count the responses by version header: for i in $(seq 1 100); do curl -s localhost:8000/app | jq -r .version; done | sort | uniq -c.
9.2 The canary plugin (Enterprise)
curl -X POST $ADMIN/routes/app-route/plugins --data name=canary \
--data config.upstream_host=app-canary.internal \
--data config.percentage=10 \
--data config.hash=consumer
# Time-based: --data config.start=<unix-time> --data config.duration=3600
# Group-based: --data 'config.groups[]=beta-testers' (needs ACL-style groups)
Know the options: percentage vs time-based progression, hashing on consumer, ip or none (random), and group-based canary for named testers.
10. Article: Logging, metrics and observability (KGLL-103)
10.1 Logging plugins
# Local file log
curl -X POST $ADMIN/services/example_service/plugins --data name=file-log \
--data config.path=/tmp/kong-requests.log
docker exec kong tail -f /tmp/kong-requests.log | jq
# HTTP log to a collector
curl -X POST $ADMIN/plugins --data name=http-log --data config.http_endpoint=http://log-collector:9000/logs
# Others: tcp-log, udp-log, syslog, loggly, datadog, statsd, zipkin, opentelemetry
The log record includes request, response, latencies (kong, proxy, request), route, service, consumer, client_ip, started_at. Be able to explain what each latency means: proxy is time waiting for the upstream, kong is Kong’s own processing, request is total time.
10.2 Prometheus metrics
curl -X POST $ADMIN/plugins --data name=prometheus
curl -s localhost:8001/metrics | head -40 # exposed on the Admin or Status API
# Key series: kong_http_requests_total, kong_latency_bucket, kong_bandwidth_bytes, kong_datastore_reachable, kong_nginx_connections_total
Point Prometheus at kong:8001/metrics (or the dedicated status_listen port) and chart rate(kong_http_requests_total[1m]) in Grafana.
10.3 Tracing and access logs
- Log files:
/usr/local/kong/logs/(access.log,error.log,admin_access.log). In Docker they are usually sent to stdout/stderr, so usedocker logs kong. - Raise verbosity with
KONG_LOG_LEVEL=debug(and revert afterwards). - Correlation: use the
correlation-idplugin so a single id appears in logs and upstream headers.
11. Article: Declarative configuration with decK
decK is the supported way to manage Kong as code and is very likely to appear in labs.
deck version
deck gateway ping # connectivity (older versions: deck ping)
deck gateway dump -o kong.yaml # export running config (older: deck dump)
deck gateway diff kong.yaml # preview changes (older: deck diff)
deck gateway sync kong.yaml # apply, including deletions (older: deck sync)
deck gateway validate kong.yaml # validate offline-ish (older: deck validate)
deck file convert / deck file merge / deck file openapi2kong # file utilities (version dependent)
The command layout changed across releases (deck sync versus deck gateway sync). Run deck --help first and use what your installed version offers.
11.1 Minimal state file
_format_version: "3.0"
services:
- name: example_service
url: http://httpbin.org
routes:
- name: example_route
paths: [/mock]
plugins:
- name: rate-limiting
config:
minute: 5
policy: local
consumers:
- username: alice
keyauth_credentials:
- key: alice-secret
11.2 Useful flags
deck gateway sync kong.yaml --kong-addr http://localhost:8001
deck gateway sync kong.yaml --select-tag lab1 # only manage tagged objects
deck gateway dump --with-id --skip-consumers -o out.yaml
With Enterprise and RBAC use --headers 'Kong-Admin-Token: <token>' and --workspace <name>. Mind the danger: sync deletes anything on the gateway that is not in the file unless you scope it with tags or --skip-*; always run diff first.
11.3 DB-less workflow
# Load config into a DB-less node
curl -i -X POST localhost:8001/config -F config=@kong.yaml
# Inspect and verify
curl -s localhost:8001/config | jq
In DB-less mode, create/update/delete endpoints on entities return 405; change the YAML and reload.
12. Article: Enterprise features that show up in labs
12.1 Workspaces and RBAC
curl -X POST localhost:8001/workspaces --data name=team-a
curl -X POST localhost:8001/team-a/services --data name=svc --data url=http://httpbin.org
# RBAC (requires enforce_rbac=on and an admin token)
curl -X POST localhost:8001/rbac/roles --data name=team-a-admin
curl -X POST localhost:8001/rbac/roles/team-a-admin/endpoints \
--data workspace=team-a --data endpoint='*' --data actions='read,create,update,delete'
curl -X POST localhost:8001/admins --data username=ann --data email=ann@example.com --data custom_id=ann
curl -X POST localhost:8001/admins/ann/roles --data roles=team-a-admin
Send Kong-Admin-Token: <token> with Admin API calls when RBAC is enforced. Remember that object names are unique per workspace, not globally.
12.2 Securing Kong itself
- Never expose the Admin API publicly; bind to
127.0.0.1or a private network, or front it with a Kong route plus an auth plugin. - Enable TLS on the Admin API (
admin_listen = ... ssl), and usessl_cert/ssl_cert_keyfor the proxy. - Certificates and SNIs:
curl -X POST $ADMIN/certificates -F cert=@server.crt -F key=@server.key -F snis=api.example.com
curl -k --resolve api.example.com:8443:127.0.0.1 https://api.example.com:8443/mock/anything
12.3 Kong Manager and Dev Portal
Know where to find Services, Routes, Consumers, Plugins, Upstreams, Workspaces and Admins in the UI, and that Dev Portal publishes specs and manages developer registration and application keys.
13. Practice lab tasks (answer key outlines)
Time yourself. Each should take under 10 minutes.
Lab 1 – Expose an API. Create service lab_svc to http://httpbin.org, route /lab with methods GET and POST, strip the path, and prove GET /lab/anything returns 200 while DELETE returns 404.
Lab 2 – Protect it. Add key-auth to the service, create consumers alice and bob, give both keys, add ACL group partners allowing only alice, and show alice 200, bob 403, anonymous 401.
Lab 3 – Throttle it. Add rate-limiting of 3 per minute for the service, 10 per minute for alice only, and show the 429 and the X-RateLimit-Remaining-Minute header.
Lab 4 – Transform it. Add a request header X-Env: prod and remove the response header Server, then confirm upstream sees the header at /anything.
Lab 5 – Balance it. Create an upstream with two targets, weights 70/30, health checks on /health, then mark one target unhealthy and confirm all traffic moves to the other.
Lab 6 – Canary it. Move 10% of traffic to a new version, ramp to 50%, then roll back, validating counts with a request loop.
Lab 7 – Observe it. Enable file-log and prometheus, generate 50 requests, then find the latencies in the log and kong_http_requests_total in the metrics output.
Lab 8 – Declare it. Dump the current state with decK, delete a service, restore by deck gateway sync, and demonstrate diff showing zero changes.
Lab 9 – Isolate it (Enterprise). Create workspace team-b, an RBAC role scoped to it, an admin bound to that role, and show the admin cannot see the default workspace.
Lab 10 – Troubleshoot it. Given a broken setup (wrong path, wrong port, disabled plugin, missing consumer key), diagnose with status codes, docker logs kong, and GET /routes, GET /plugins.
14. Exam-day strategy
- Read every task fully and note whether it names an interface (Admin API, decK, UI) before starting.
- Use consistent names exactly as the task states; graders often check by name.
- Verify through the proxy port after each change and keep the successful curl output.
- Use tags and
jqto keep your environment tidy and your output readable. - When stuck, query
/schemas/plugins/<name>,deck --help, orkong --helprather than guessing field names. - Check plugin scope and ordering before assuming a plugin is broken; a more specific scope may be overriding it.
- Budget your time: do the tasks you are confident about first, then return to the longer ones.
15. One-page cheat sheet
| Task | Command |
|---|---|
| Create service | POST /services name=… url=… |
| Create route | POST /services/{svc}/routes name=… paths[]=… |
| Add plugin | POST /{services,routes,consumers}/{id}/plugins name=… or POST /plugins for global |
| Create consumer + key | POST /consumers username=… then POST /consumers/{c}/key-auth key=… |
| ACL group | POST /consumers/{c}/acls group=… |
| Upstream + target | POST /upstreams name=…, POST /upstreams/{u}/targets target=host:port weight=… |
| Health of upstream | GET /upstreams/{u}/health |
| Plugin schema | GET /schemas/plugins/{name} |
| Enabled plugins | GET /plugins/enabled |
| Export config | deck gateway dump -o kong.yaml |
| Diff / apply | deck gateway diff kong.yaml / deck gateway sync kong.yaml |
| Reload / health | kong reload / kong health |
| Metrics | GET /metrics with the prometheus plugin enabled |
16. Sources and next steps
- Kong Academy exam-preparation and certification pages (confirm current objectives and format).
- Kong documentation at developer.konghq.com for plugin references and decK.
- Official learning labs KGLL-101, KGLL-103 and KGLL-106, plus the Kong Gateway Operations course.
This guide covers the command-line skill set. If you tell me which interface the lab allows (Admin API only, decK, or Kubernetes with the Ingress Controller), I can add a dedicated article for it, for example KongPlugin and KongConsumer custom resources via kubectl.