telepresence status).
1) Find the deployment to intercept
List deployments to identify the workload you want to intercept (example:auth-depl):
2) Choose local and service ports
Decide which local port your process will listen on and the service port used by the pod.
If the pod only exposes one port, the service port suffix can be omitted in the intercept command. If multiple ports exist on the workload, specify the service port (e.g.,
:3000).
3) Create the intercept
Map a local port to the service port and create the intercept:127.0.0.1:8000 on your machine.
4) Run the service locally
Switch to the service directory and start the app so it listens on the chosen local port (8000 in the example).
Example index.js (auth service) listening on port 8000:
Running the service locally lets you use your IDE and debugger directly on code that would otherwise run in the cluster — no image build/push required.
5) Verify the cluster routes traffic to your local process
From inside the cluster (for example, from another pod or using cluster DNS), a request to the service name should route to your local process. Example: curl the serviceauth-service on port 3000 from another pod:
6) What Telepresence installs in the pod?
When an intercept is active, Telepresence adds atraffic-agent container to the intercepted pod to forward traffic.
Inspect pods and describe the intercepted pod:
traffic-agent container is responsible for redirecting the pod traffic to your machine.
7) Remove an intercept
List current intercepts:auth-depl is intercepted:
8) Intercept another service (example: products)
Repeat the same workflow for additional deployments. Example forproducts-depl:
- Identify the deployment:
- Create an intercept (use a different local port if
8000is in use, e.g.,9000):
- Run the
productsservice locally and ensure it listens on the chosen port.
9) Debugging: missing environment variables when running locally
When you run service code outside the pod, the pod’s environment variables are not automatically available on your machine. If the service relies on pod-provided env vars (for service discovery, API URLs, credentials, etc.), you must replicate them locally. Example symptom observed for theproducts service:
- Public LoadBalancer requests hung.
- Local
productsprocess logged:
API_URL was undefined locally. Relevant server code:
apiURL was populated from an environment variable:
API_URL:
- Create a
.envfile and usedotenv. export API_URL="http://inventory-service:3000/"in your shell.- Use a tooling approach to inject pod env into your local environment.
Tip: If you see a URL- or host-related error after intercepting, check that any service discovery or env vars used to contact other services are present in your local environment.
Summary & quick reference
- Create an intercept:
telepresence intercept <deployment> -p <localPort>:<servicePort>
- Start your service locally on
<localPort>. - Telepresence injects a
traffic-agentcontainer into the pod to forward traffic. - To remove an intercept:
telepresence leave <intercept-name>. - Remember to replicate pod environment variables locally if your code depends on them.
Links and references
- Telepresence documentation: https://www.telepresence.io/docs/
- Kubernetes docs (Deployments): https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
- Node.js: https://nodejs.org/
- Express: https://expressjs.com/