Docsright arrowTelepresence OSSright arrowProxy outbound traffic to my cluster

3 min • read

Proxy outbound traffic to my cluster

Telepresence offers other options for proxying traffic between your laptop and the cluster. This section discribes how to proxy outbound traffic and control outbound connectivity to your cluster.

Proxying outbound traffic

Connecting to the cluster instead of running an intercept allows you to access cluster workloads as if your laptop was another pod in the cluster. This enables you to access other Kubernetes services using <service name>.<namespace>. A service running on your laptop can interact with other services on the cluster by name.

When you connect to your cluster, the background daemon on your machine runs and installs the Traffic Manager deployment into the cluster of your current kubectl context. The Traffic Manager handles the service proxying.

  1. Run telepresence connect and enter your password to run the daemon.

  2. Run telepresence status to confirm connection to your cluster and that it is proxying traffic.

  3. Access your service by name with curl web-app.emojivoto:80. Telepresence routes the request to the cluster, as if your laptop is actually running in the cluster.

If you terminate the client with telepresence quit and try to access the service again, it will fail because traffic is no longer proxied from your laptop.

Controlling outbound connectivity

Connected Namespace

The telepresence connect command will connect to the default namespace, i.e. the namespace that your current kubernetes context is configured to use, or a namespace named "default". When connected, you can access all services in this namespace by just using a single label name of the service.

You can specify which namespace to connect to by using a --namespace <name> to the connect command.

Mapped Namespaces

By default, Telepresence provides access to all Services found in all namespaces in the connected cluster. This can lead to problems if the user does not have RBAC access permissions to all namespaces. You can use the --mapped-namespaces <comma separated list of namespaces> flag to control which namespaces are accessible.

When you use the --mapped-namespaces flag, you need to include all namespaces containing services you want to access, as well as all namespaces that contain services related to the intercept.

The resources in the given namespace can now be accessed using unqualified names as long as the intercept is active. You can deactivate the intercept with telepresence leave <deployment name>. This removes unqualified name access.