
Prerequisites
- A Kubernetes cluster and
kubectlconfigured to the correct context - Telepresence CLI installed (
brew install telepresenceor 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:
Here’s the relevant snippet from the Kubernetes manifest:
3. Run the Service Locally
Switch to your local service directory and start the server on port 8000:4. Verify the Intercept
Usecurl to hit the Kubernetes service name. Telepresence will route this to your local process:
5. Inspect the Pod
Observe both the original container and Telepresence’s traffic agent:- 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
-
Stop your local auth service (
Ctrl+C) -
List deployments again:
-
Intercept the products deployment:
-
Run the products service locally:
-
Verify with:
8. Debugging an Error
If your request hangs and you see: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:API_URL and any other Pod-specific variables.
Links and References
- Telepresence Documentation
- Kubernetes Services
- Express.js Guide
- Docker Hub: sanjeevkt720/telepresence-auth