Service Intercepts

Intercept a service to route its traffic to your workspace. Requests that would go to the service in the environment are redirected to your local code instead.

How it works

1. Start an intercept for a service (e.g., api)

2. All traffic to that service is redirected to your workspace

3. Debug with real requests, then stop the intercept to restore normal flow

Prerequisite

You must first connect to an environment with kl env connect before intercepting services.

Starting Intercepts

kl intercept start

Start intercepting a service. You'll be prompted to configure port mapping.

kl intercept start           # Interactive service selection
kl intercept start api       # Intercept specific service

Port mapping

Map the service port to your workspace port where your local server runs.

# Service port 8080 → Workspace port 3000
# Traffic to api:8080 now reaches localhost:3000

Managing Intercepts

List active intercepts

kl intercept list

Shows service name, phase (Active/Pending/Failed), and port mappings.

Check status

kl intercept status api

Detailed info including workspace pod, port mappings, and start time.

Stop intercept

kl intercept stop            # Interactive selection
kl intercept stop api        # Stop specific service

Traffic routes back to the original service within seconds.