Telepresence For Kubernetes

Telepresence For Kubernetes

Volumes

When you intercept a Kubernetes service locally using Telepresence, any volumes mounted by the original container won’t automatically appear on your host. To ensure your local process reads from or writes to the same volume, you must explicitly mount it. This guide covers intercepting a deployment with and without volume mounts, customizing the mount point, and verifying where the volume is available on your machine.

Prerequisites

  • A running Kubernetes cluster
  • telepresence CLI installed (install guide)
  • A Deployment named products-depl that uses a volume

1. Intercept Without Volume Mount

By default, intercepting a service only redirects traffic—you won’t have access to the original volume on your local file system:

telepresence intercept products-depl --port 8000:3000

Use this when your local process doesn’t need the container’s on-disk data.

2. Intercept With Volume Mount

If your container reads or writes data to a volume, add the --mount flag. Telepresence will mount the volume into a randomly generated directory on your host:

telepresence intercept products-depl \
  --port 8000:3000 \
  --mount

Customizing the Local Mount Point

To choose a specific directory on your machine, pass --mount=<path>:

telepresence intercept products-depl \
  --port 8000:3000 \
  --mount=/tmp/products-data

Note

When you specify a mount point, ensure the directory exists and you have write permissions.
Telepresence won’t create nested directories for you.

3. Command Reference

CommandDescription
telepresence intercept products-depl --port 8000:3000Intercept without mounting the volume
telepresence intercept products-depl --port 8000:3000 --mountMount the volume at a random local directory
telepresence intercept products-depl --port 8000:3000 --mount=/tmp/Mount the volume at /tmp/ on the host
telepresence listList current intercepts and their mount points

4. Verifying the Volume Mount

Run the following to see active intercepts and where volumes are mounted locally:

telepresence list

Example output:

$ telepresence list
auth-depl      : ready to intercept (traffic-agent already installed)
inventory-depl : ready to intercept (traffic-agent not yet installed)
products-depl  : intercepted
    Intercept name         : products-depl
    State                  : ACTIVE
    Workload kind          : Deployment
    Destination            : 127.0.0.1:8000
    Service Port Identifier: 3000/TCP
    Volume Mount Point     : /tmp/telfs-1147625726
    Intercepting           : all TCP connections
FieldDescription
Intercept nameThe identifier for this intercept
StateACTIVE if currently intercepting, otherwise READY
Workload kindKubernetes resource type (e.g., Deployment, StatefulSet)
DestinationLocal address and port where traffic is forwarded
Service Port IdentifierOriginal service port and protocol
Volume Mount PointLocal directory where the pod’s volume is mounted

Further Reading

Watch Video

Watch video content

Previous
Demo Env file