Skip to main content
Intercept a Kubernetes pod using Telepresence, mount its ConfigMap volume on your local machine, and access configuration data as if the service were running in-cluster.

Table of Contents

Prerequisites

  • Kubernetes cluster access with kubectl configured
  • Telepresence installed
  • A local .env file for environment variables
Ensure your kubectl context is pointing to the intended cluster before starting the intercept.

Node.js Service Example

The products service is an Express.js app that reads API_URL from environment variables:

Kubernetes Deployment with ConfigMap Volume

Deploy the products-depl Deployment and mount a ConfigMap called db-info at /tmp:

ConfigMap Definition

Define your database connection details in a ConfigMap:

Intercepting with Telepresence and Mounting Volumes

  1. Check for existing intercepts:
  2. Create an intercept on port 8000, inject your .env, and mount the pod’s volumes:
Redirecting service traffic through your local machine may impact production workloads. Proceed with caution.
Example output (identifiers will vary):

Exploring the Mounted Volume

In a new terminal:
You now have file-based access to the ConfigMap data.

Customizing the Local Mount Path

  1. End the current intercept:
  2. Start a new intercept with a custom mount location:
Files now appear under /tmp/example123/tmp:
Adjust your application or use symbolic links to consume these local files seamlessly.

References

Watch Video