Kong Gateway Certified Associate practical lab scenarios

To prepare effectively for the Kong Gateway Certified Associate practical lab, you should practice across the five core domains tested in the hands-on section. Because the grading script evaluates the final state of your Kong Gateway instance, accuracy in entity names, plugin configurations, and declarative syncing is essential.

Below is a comprehensive guide covering five complete exam-style scenarios—spanning declarative configuration, load balancing, security, RBAC, and troubleshooting—with step-by-step solutions and verification checks.


Scenario 1: Declarative Configuration & Traffic Transformation (decK)

Exam Domain: Declarative Management & Traffic Control
Goal: Deploy a service using decK that modifies incoming headers before forwarding requests to the backend.

The Prompt

Create a declarative configuration file named payments.yaml and sync it to Kong Gateway with the following requirements:
1. Define a Service named payments-service pointing to http://httpbin.org.
2. Attach a Route named payments-route matching the path /v1/payments and the Host header api.payments.local.
3. Configure the Request Transformer plugin on payments-route so that every forwarded request automatically injects the header X-Gateway-Source: Kong-Prod and removes any incoming X-Debug header.

Step-by-Step Solution

  1. Create payments.yaml:yaml_format_version: "3.0" services: - name: payments-service url: http://httpbin.org routes: - name: payments-route paths: - /v1/payments hosts: - api.payments.local plugins: - name: request-transformer config: add: headers: - X-Gateway-Source:Kong-Prod remove: headers: - X-Debug Use code with caution.
  2. Validate and Preview the State:bashdeck gateway validate -s payments.yaml deck gateway diff -s payments.yaml Use code with caution.
  3. Apply the Configuration:bashdeck gateway sync -s payments.yaml Use code with caution.(Exam Tip: If other services already exist in the lab environment, use --select-tag or dump the existing state first so deck gateway sync does not delete unrelated exam tasks).

Verification

Send a test request containing the Host header and an X-Debug header:

bash

curl -i http://localhost:8000/v1/payments \
  -H "Host: api.payments.local" \
  -H "X-Debug: true"

Use code with caution.

Inspect the JSON response from httpbin.org to confirm "X-Gateway-Source": "Kong-Prod" is present and "X-Debug" is absent.


Scenario 2: Load Balancing & Active Health Checks

Exam Domain: Upstreams, Targets & High Availability
Goal: Distribute traffic across multiple backend nodes with weighted routing and automatic failover.

The Prompt

Configure load balancing for a backend microservice called catalog-api:
1. Create an Upstream named catalog-upstream.
2. Enable active HTTP health checks on catalog-upstream probing the /status/200 path every 5 seconds. Mark a target healthy after 2 successes and unhealthy after 2 HTTP failures.
3. Add two targets to catalog-upstream: httpbin.org:80 with a weight of 80, and mockbin.org:80 with a weight of 20.
4. Create a Service named catalog-service using http://catalog-upstream as its host, and expose it via a Route named catalog-route on /catalog.

Step-by-Step Solution

  1. Create the Upstream with Active Health Checks:bashcurl -i -X POST http://localhost:8001/upstreams \ --data name=catalog-upstream \ --data healthchecks.active.http_path=/status/200 \ --data healthchecks.active.healthy.interval=5 \ --data healthchecks.active.healthy.successes=2 \ --data healthchecks.active.unhealthy.interval=5 \ --data healthchecks.active.unhealthy.http_failures=2 Use code with caution.
  2. Add the Weighted Targets:bashcurl -i -X POST http://localhost:8001/upstreams/catalog-upstream/targets \ --data target=httpbin.org:80 \ --data weight=80 curl -i -X POST http://localhost:8001/upstreams/catalog-upstream/targets \ --data target=mockbin.org:80 \ --data weight=20 Use code with caution.
  3. Create the Service and Route:bashcurl -i -X POST http://localhost:8001/services \ --data name=catalog-service \ --data host=catalog-upstream \ --data path=/anything curl -i -X POST http://localhost:8001/services/catalog-service/routes \ --data name=catalog-route \ --data "paths[]=/catalog" Use code with caution.

Verification

Check target health status via the Admin API:

bash

curl -s http://localhost:8001/upstreams/catalog-upstream/health | jq

Use code with caution.

Confirm both targets report "health": "HEALTHY" once the initial probes complete.


Scenario 3: Multi-Tier Consumer Security (JWT + ACL)

Exam Domain: Authentication & Access Control
Goal: Restrict an API route so only authenticated consumers belonging to a specific group can access it.

The Prompt

Protect an existing Service named reports-service (exposed on /reports):
1. Enable the JWT plugin on reports-service.
2. Enable the ACL plugin on reports-service so only consumers in the finance-team group are allowed.
3. Create a Consumer named alice, assign her to the finance-team ACL group, and create a JWT credential for her with key alice-issuer and secret super-secret-jwt-key.

Step-by-Step Solution

  1. Enable JWT and ACL Plugins on the Service:bashcurl -i -X POST http://localhost:8001/services/reports-service/plugins \ --data name=jwt curl -i -X POST http://localhost:8001/services/reports-service/plugins \ --data name=acl \ --data "config.allow[]=finance-team" Use code with caution.
  2. Create Consumer alice and Assign ACL Group:bashcurl -i -X POST http://localhost:8001/consumers \ --data username=alice curl -i -X POST http://localhost:8001/consumers/alice/acls \ --data group=finance-team Use code with caution.
  3. Create the JWT Credential:bashcurl -i -X POST http://localhost:8001/consumers/alice/jwt \ --data key=alice-issuer \ --data secret=super-secret-jwt-key Use code with caution.

Verification

  • A request without a token (curl -i http://localhost:8000/reports) must return 401 Unauthorized.
  • A request with a valid HS256 JWT signed with super-secret-jwt-key and "iss": "alice-issuer" in the payload (curl -i http://localhost:8000/reports -H "Authorization: Bearer <token>") must return 200 OK.

Scenario 4: Workspaces & Role-Based Access Control (RBAC)

Exam Domain: Kong Enterprise Governance & Administration
Goal: Isolate team resources into a dedicated workspace and grant least-privilege admin access.

The Prompt

A new development team needs an isolated workspace to manage their own APIs:
1. Create a Workspace named mobile-team.
2. Inside mobile-team, create a Role named mobile-dev.
3. Grant the mobile-dev role full CRUD (create, read, update, delete) permissions on /services/* and /routes/* within the mobile-team workspace.
4. Create an RBAC User named dev-lead with the token mobile-token-999 and assign the mobile-dev role to this user.

Step-by-Step Solution

  1. Create the Workspace:bashcurl -i -X POST http://localhost:8001/workspaces \ --data name=mobile-team Use code with caution.
  2. Create the Role inside the mobile-team Workspace:bashcurl -i -X POST http://localhost:8001/mobile-team/rbac/roles \ --data name=mobile-dev Use code with caution.
  3. Add Endpoint Permissions to the Role:bashcurl -i -X POST http://localhost:8001/mobile-team/rbac/roles/mobile-dev/endpoints \ --data endpoint=/services/* \ --data actions=create,read,update,delete curl -i -X POST http://localhost:8001/mobile-team/rbac/roles/mobile-dev/endpoints \ --data endpoint=/routes/* \ --data actions=create,read,update,delete Use code with caution.
  4. Create the RBAC User and Attach the Role:bashcurl -i -X POST http://localhost:8001/rbac/users \ --data name=dev-lead \ --data user_token=mobile-token-999 curl -i -X POST http://localhost:8001/mobile-team/rbac/users/dev-lead/roles \ --data roles=mobile-dev Use code with caution.

Verification

Test RBAC enforcement using the new user’s token:

  • Listing services in mobile-team succeeds (200 OK):bashcurl -i http://localhost:8001/mobile-team/services -H "Kong-Admin-Token: mobile-token-999" Use code with caution.
  • Listing consumers or accessing the default workspace fails (403 Forbidden):bashcurl -i http://localhost:8001/default/services -H "Kong-Admin-Token: mobile-token-999" Use code with caution.

Scenario 5: Troubleshooting Broken Routing & Plugin Conflicts

Exam Domain: Diagnostics & Debugging
Goal: Identify why an existing API returns 404 or 401 errors and resolve the misconfigurations.

The Prompt

Users report two issues with the shipping-api:
1. Requests to http://localhost:8000/shipping/track return 404 Not Found from the upstream backend, even though the backend expects /track.
2. Internal monitoring scripts sending requests with X-Api-Key: monitor-123 receive 401 Unauthorized.
Diagnose both issues and resolve them.

Step-by-Step Diagnostic & Fix

  1. Inspect the Route Configuration:bashcurl -s http://localhost:8001/routes | jq Use code with caution.
    • Finding 1: On shipping-route (matching /shipping), strip_path is set to false. Consequently, Kong forwards /shipping/track to the backend instead of stripping /shipping and forwarding /track.
    • Fix 1: Patch the route to enable strip_path:bashcurl -i -X PATCH http://localhost:8001/routes/shipping-route \ --data strip_path=true Use code with caution.
  2. Inspect Active Plugins on the Service and Route:bashcurl -s http://localhost:8001/plugins | jq Use code with caution.
    • Finding 2: The key-auth plugin has config.key_names configured as ["apikey"] (the default), so Kong ignores the custom X-Api-Key header sent by the monitoring script.
    • Fix 2: Patch the plugin to accept both apikey and X-Api-Key:bashcurl -i -X PATCH http://localhost:8001/plugins/<key-auth-plugin-id> \ --data "config.key_names[]=apikey" \ --data "config.key_names[]=X-Api-Key" Use code with caution.

Verification

Run the monitoring request again:

bash

curl -i http://localhost:8000/shipping/track -H "X-Api-Key: monitor-123"

Use code with caution.

Confirm the gateway authenticates the header and routes /track cleanly (200 OK).


Exam Day Best Practices for Practical Tasks

  • Never wipe the entire gateway accidentally: Before running deck gateway sync, always check whether other tasks share the same Kong instance. Dump the current configuration (deck gateway dump -o backup.yaml) before making major changes.
  • Watch out for strip_path defaults: Via the Admin API, strip_path defaults to true on HTTP routes, whereas declarative files or modified routes may behave differently if explicitly overridden. Always verify the exact path forwarded to the upstream.
  • Use jq for rapid inspection: Piping Admin API responses into jq (curl -s http://localhost:8001/plugins | jq) makes finding IDs and spotting typos in plugin config blocks significantly faster.

Leave a Reply

Your email address will not be published. Required fields are marked *