Skip to main content
Version: 2.24

Telepresence Docker Compose Extension

The x-tele extension is added either at the top level or to a service. E.g.

x-tele:
connections:
- namespace: <name>
services:
some-name:
x-tele:
type: <extension type>
...

Those extensions are recognized by the telepresence compose, which acts as an extended docker compose command. Telepresence will create connections, engagements, and proxies based on the extensions and then modify the docker compose file with the necessary networks, mounts, and environment variables to make the extended services work.

States

  • telepresence compose up will ensure that the extended services are in the correct state.
  • telepresence compose create is like up, but it will not start the containers, and therefore end any existing engagements once all the containers are created.
  • telepresence compose stop ends the engagements, but it keeps telepresence connected, because the existing containers use the teleroute network backed by that connection.
  • telepresence compose down will end the engagements, terminate the network, and quit telepresence.
  • telepresence config will detect if the project is started, if so, produce the extended project file. Otherwise, it will produce the original project file's canonical form.
  • telepresence quit will detect if a telepresence compose is running and, if so, issue a telepresence compose down.

Top-level Extension

The Top-level extension describes the connection and mount configurations that are used by the service extensions:

NameDescriptionTypeDefault Value
connectionsConnection configurations.connection configsempty
mountsMount configurations.mount configsempty

Connection Configuration

The connections field is a list of connection configurations. A single connection using the defaults from the current Kubernetes context is created when the list is empty.

Each connection configuration is an object with the following fields:

NameDescriptionTypeDefault Value
nameThe connection namestringgenerated based on the current Kubernetes context and namespace
namespaceThe namespace to connect tostringThe namespace configured in the current Kubernetes context
also-proxySubnets that Telepresence should proxy in addition to the service and pod subnets.CIDRsempty
never-proxySubnets that Telepresence should never proxy.CIDRsempty
manager-namespaceThe namespace in which the Telepresence Traffic Manager is running.stringThe name specified in the client config or "ambassador"
mapped-namespacesNamespaces that Telepresence should map as DNS domains.stringsempty

Mount Configuration

The mounts field is a list of mount configurations that controls how the service extensions handle the volumes shared by the traffic-agent that the extended service will engage with. The mount configuration is an object with the following fields:

NameDescriptionTypeDefault Value
volumeName of a Docker Compose volume. Mutually exclusive to volumePattern.stringempty
volumePatternRegular expression pattern matching one or several Docker Compose volumes. Mutually exclusive to volume.stringempty
policy"local", "remote", or "remoteReadOnly"stringdetermined by the traffic-agent

The mount policy determines how the volume is mounted by Docker Compose.

local
The Docker Compose volume is not modified.
remote
The Docker Compose volume is modified to mount a remote volume without a read-only restriction. It might still be restricted by the remote volume's permissions.
remoteReadOnly
The Docker Compose volume is modified to mount a remote volume read-only restriction.

Service Extensions

The x-tele extension can be added to a Docker Compose service to extend the service's behavior. The extension must have a type field. Available types are:

TypeLocal service BehaviorSimilar to
connectService has access to the cluster's resources (DNS and routing)telepresence connect
proxyReplaced with a proxy for a service in the clusterN/A
ingestActs as the handler for an ingested container the clustertelepresence ingest
interceptActs as the handler for an intercepted service the clustertelepresence intercept
replaceReplaces a remote container in the clustertelepresence replace
wiretapReceives wiretapped data from a service in the clustertelepresence wiretap

connect

The connect extension can be used as is, but it is also the base for all the other extensions. It will ensure that the extended docker compose service has access to the cluster's network and DNS by injecting a teleroute network. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty

The connection field is required only when more than one connection is declared in the top-level x-tele extension.

proxy

The proxy extension replaces the extended docker compose service with a proxy that redirects all traffic to a workload in the cluster. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty
nameName of the proxied remote servicestringname of the compose service
portsList of <service-port>:<remote service-port>> mappingsstringsempty (route all ports as-is)

ingest

The ingest ensures that the docker compose service shares the environment and volumes of a remote container in the cluster. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty
nameName of the remote workload (typically the deployment)stringname of the compose service
containerName of the remote containerstringempty
to-podPorts to forward from the local compose service to the remote pod's localhoststringsempty

The container field is required when more than one container is declared in the remote workload.

intercept

The intercept ensures that the docker compose service receives traffic from, and shares the environment and volumes of, a remote container in the cluster. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty
nameName of the intercept engagementstringname of the compose service
workloadName of the remote workload (typically the deployment)stringname of the engagement
portsService <local port>:<service port> to interceptstringsempty
serviceName of the remote servicestringempty
to-podPorts to forward from the local compose service to the remote pod's localhoststringsempty

The service field is optional as long as the given ports are unique. The workload is useful when doing multiple intercepts on the same workload using different intercept names.

replace

The replace ensures that the docker compose service receives traffic from, and shares the environment and volumes of, a remote container in the cluster. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty
nameName of the remote workload (typically the deployment)stringname of the compose service
containerName of the remote containerstringempty
portsService <local port>:<container port> to replacestringsempty
to-podPorts to forward from the local compose service to the remote pod's localhoststringsempty

wiretap

The wiretap ensures that the docker compose service receives wiretapped traffic from a remote service, and shares the environment and volumes (read-only) of, a remote container. The extension can have the following fields set:

NameDescriptionTypeDefault Value
connectionThe name of a connection declared in the top-level x-tele extensionstringempty
nameName of the wiretapped workload (typically the deployment)stringname of the compose service
portsService <local port>:<service port> to wiretapstringsempty
serviceName of the remote servicestringempty
to-podPorts to forward from the local compose service to the remote pod's localhoststringsempty

The service field is optional as long as the given service ports are unique.