Skip to main content
In this lesson, you’ll learn how to use Telepresence to intercept traffic from a Kubernetes service and run the workload locally for fast, iterative debugging.
The image shows a Visual Studio Code interface with a terminal open, displaying a command prompt connected via SSH. The file explorer on the left lists several project files and directories.

Prerequisites

  • A Kubernetes cluster and kubectl configured to the correct context
  • Telepresence CLI installed (brew install telepresence or see the official docs)
  • Node.js (v14+) and npm
Make sure your Kubernetes context is set to the target namespace, and you have permissions to create interceptions.

1. List Your Deployments

Identify the deployment you want to intercept:

2. Create an Intercept

First, connect Telepresence to your cluster if you haven’t already:
Then run:
Here’s the relevant snippet from the Kubernetes manifest:
You should see output similar to:

3. Run the Service Locally

Switch to your local service directory and start the server on port 8000:
Ensure your Express app listens on port 8000:

4. Verify the Intercept

Use curl to hit the Kubernetes service name. Telepresence will route this to your local process:
Expected response:

5. Inspect the Pod

Observe both the original container and Telepresence’s traffic agent:
Look for two containers:
  • auth (port 3000/TCP)
  • traffic-agent (port 9900/TCP)

6. Remove the Intercept

When you’re done debugging, clear the intercept:

7. Switch to the Products Service

  1. Stop your local auth service (Ctrl+C)
  2. List deployments again:
  3. Intercept the products deployment:
  4. Run the products service locally:
  5. Verify with:

8. Debugging an Error

If your request hangs and you see:
Inspect your route handler:
apiURL is undefined locally because the environment variable from the Pod isn’t set in your shell.

9. Import Environment Variables

To mirror the Pod’s settings, pull the env vars into your local shell:
Now restart your local service so it picks up API_URL and any other Pod-specific variables.

Watch Video