Skip to content

Commit 4d66e8f

Browse files
committed
W.I.P. Blog entry for version 2.21.0
Signed-off-by: Thomas Hallgren <[email protected]>
1 parent fa6fc23 commit 4d66e8f

File tree

3 files changed

+113
-15
lines changed

3 files changed

+113
-15
lines changed

blog/2024-12-10-telepresence-2.21.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Telepresence 2.21
3+
description: What's new in Telepresence 2.21.
4+
slug: telepresence-2.21
5+
authors:
6+
- name: Thomas Hallgren
7+
title: Maintainer of Telepresence OSS
8+
url: https://github.com/thallgren
9+
image_url: https://github.com/thallgren.png
10+
socials:
11+
linkedin: https://www.linkedin.com/in/thallgren/
12+
---
13+
14+
Telepresence 2.21.0 has been released, and here is a walkthrough of its many new features, such as automatic VPN
15+
conflict avoidance, the new `telepresence ingest` command, and the improved docker support provided by commands like
16+
`telepresence curl` and `telepresence docker-run`.
17+
18+
<!-- truncate -->
19+
20+
## No More VPN Conflicts
21+
22+
One of the most common problems for Telepresence users has been that the IP ranges used by the Kubernetes cluster that
23+
they connect to collide with IP ranges provided by other already existing networks on the workstation. Telepresence
24+
would refuse to connect when such a conflict was detected, and require that the user somehow specified how to resolve
25+
it. This is no longer the case. Starting with version 2.21.0, Telepresence will proactively resolve the conflict by
26+
moving the cluster subnets out of the way!
27+
28+
### Virtual Network Address Translation (VNAT)
29+
The process of moving a subnet is fairly simple. The Telepresence DNS resolver will translate IPs returned by the
30+
cluster DNS resolver into an IP range that is guaranteed not to conflict, and the Telepresence Virtual Network
31+
Interface will then translate them back to their original on access.
32+
33+
Telepresence will also ensure that any references to those IPs in the environment that is propagated when using
34+
`telepresence ingest` or `telepresence intercept` are translated as well. A local process using the environment will
35+
hence be able to use those IPs to connect to resources in the cluster.
36+
37+
### VNAT Caveats
38+
39+
Telepresence may not accurately detect cluster-side IP addresses being used by services running locally on a workstation
40+
in certain scenarios. This limitation arises when local services obtain IP addresses from remote sources such as
41+
databases or configmaps, or when IP addresses are sent to it in API calls.
42+
43+
Using commands like `nslookup <svc name>` may show different IP addresses than the ones shown when using commands like
44+
`kubernetes get svc <svc name>` if the service subnet is subjected to VNAT translation. The same is true for if using
45+
`nslookup <pod name>` and `kubernetes get pod -o wide`.
46+
47+
In situations where VNAT causes problems, it can be disabled. Consult the Technical Reference documentation for more
48+
details on how to do that.
49+
50+
## New Ingest Command
51+
52+
Sometimes, intercepting network traffic to a container isn't the most efficient solution. For example, if you're working
53+
with a Kafka service that only interacts with a message broker, or if you're planning to send data to your local
54+
application through other means, just accessing the container's environment and volume mounts might be more practical.
55+
The new `telepresence ingest <workload> [--container <container name>]` command was designed for exactly this purpose.
56+
57+
The ingest and intercept commands are very similar, but while the intercept will target a port to intercept (and
58+
implicitly a container), the ingest command will target a container directly.
59+
60+
An ingest is also less intrusive. Since volumes are always mounted read-only, and everything happens on the client side,
61+
there's no conflict when several ingests of the same container, possibly on different workstations, happen
62+
simultaneously.
63+
64+
## Improved Docker Support
65+
66+
The cluster network that Telepresence makes available when connecting using `telepresence connect --docker`, will be
67+
confined to the daemon container, so commands like `curl` or `nslookup` would not find the cluster resources when
68+
executed on the host. To run a curl command, you'd have to do something like:
69+
70+
### telepresence curl
71+
72+
```bash
73+
docker run --network container:<daemon container name> curlimages/curl <name of service>
74+
```
75+
76+
The command `telepresence curl` will run a standard `curl` from a docker image that shares the daemon container's
77+
network, and the above can be replaced with:
78+
79+
```bash
80+
telepresence curl <name of service>
81+
```
82+
83+
### telepresence docker-run
84+
85+
The telepresence docker-run will do a `docker run` and attach the daemon network. It will also ensure that port
86+
flags like `--publish`, `--expose` works by circumventing the Docker network limitation using ephemeral socat
87+
containers. It will even enable adding additional `--network` flags by temporarily adding them to the daemon container.
88+
89+
The `telpresence intercept/ingest --docker-run` now also leverages this technique.
90+
91+
92+
93+

docusaurus.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ const config: Config = {
124124
docId: 'quick-start',
125125
label: 'Docs',
126126
},
127+
{
128+
to: 'blog',
129+
position: 'left',
130+
label: 'Blog'
131+
},
127132
{
128133
to: 'case-studies',
129134
position: 'left',

versioned_docs/version-2.21/howtos/intercepts.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ network telepresence, and remote mounts must be made relative to a specific moun
4848
```
4949

5050
3. Get the name of the port you want to intercept on your service:
51-
`kubectl get service &lt;service name&gt; --output yaml`.
52-
51+
`kubectl get service <service name> --output yaml`.
52+
5353
If we assume that the service and deployment use the same name:
5454

5555
```console
@@ -64,8 +64,8 @@ network telepresence, and remote mounts must be made relative to a specific moun
6464
```
6565

6666
4. Intercept all traffic going to the application in your cluster:
67-
```
68-
telepresence intercept &lt;workload-name&gt; --port [&lt;local-port&gt;][:&lt;remote-port&gt;] --env-file &lt;path-to-env-file&gt;`.
67+
```bash
68+
telepresence intercept <workload-name> --port [<local-port>][:<remote-port>] --env-file <path-to-env-file>`.
6969
```
7070

7171
* For `--port`: specify the port the local instance of your application is running on. If the intercepted service exposes multiple ports, specify the port you want to intercept after a colon.
@@ -84,7 +84,7 @@ network telepresence, and remote mounts must be made relative to a specific moun
8484
Intercepting : all TCP connections
8585
```
8686

87-
5. &lt;a name="start-local-instance"&gt;&lt;/a&gt;Start your local application using the environment variables retrieved in the previous step.
87+
5. Start your local application using the environment variables retrieved in the previous step.
8888
The following are some examples of how to pass the environment variables to your local process:
8989
* **Visual Studio Code:** specify the path to the environment variables file in the `envFile` field of your configuration.
9090
* **JetBrains IDE (IntelliJ, WebStorm, PyCharm, GoLand, etc.):** use the [EnvFile plugin](https://plugins.jetbrains.com/plugin/7861-envfile).
@@ -128,7 +128,7 @@ present challenges in terms of toolchain integration, debugging, and the overall
128128
```
129129

130130
3. Get the name of the port you want to intercept on your service:
131-
`kubectl get service &lt;service name&gt; --output yaml`.
131+
`kubectl get service <service name> --output yaml`.
132132

133133
If we assume that the service and deployment use the same name:
134134

@@ -144,8 +144,8 @@ present challenges in terms of toolchain integration, debugging, and the overall
144144
```
145145

146146
4. Intercept all traffic going to the application in your cluster, and start a local container to handle that intercept:
147-
```
148-
telepresence intercept &lt;workload-name&gt; --port [&lt;local-port&gt;][:&lt;remote-port&gt;] --docker-run -- &lt;your local container&gt;.
147+
```bash
148+
telepresence intercept <workload-name> --port [<local-port>][:<remote-port>] --docker-run -- <your local container>.
149149
```
150150

151151
* For `--port`: If the intercepted service exposes multiple ports, specify the service port you want to intercept after a colon.
@@ -156,15 +156,15 @@ present challenges in terms of toolchain integration, debugging, and the overall
156156
cluster get routed to the local container and the environment variables of the service are written to `~/example-app-intercept.env`.
157157

158158
```console
159-
$ telepresence intercept example-app --port :http --docker-run -- &lt;your local container&gt;
159+
$ telepresence intercept example-app --port :http --docker-run -- <your local container>
160160
Using Deployment example-app
161161
intercepted
162162
Intercept name: example-app
163163
State : ACTIVE
164164
Workload kind : Deployment
165165
Destination : 127.0.0.1:8080
166166
Intercepting : all TCP connections
167-
&lt;output from your local container&gt;
167+
<output from your local container>
168168
```
169169

170170
5. Query the cluster in which you intercepted an application and verify your local instance being invoked.
@@ -192,7 +192,7 @@ This example assumes that you have the `example-app`
192192
$ telepresence connect
193193
Launching Telepresence User Daemon
194194
Launching Telepresence Root Daemon
195-
Connected to context xxx, namespace default (https://&lt;some url&gt;)
195+
Connected to context xxx, namespace default (https://<some url>)
196196
$ telepresence ingest example-app --env-file ~/example-app-intercept.env
197197
Using Deployment example-app
198198
Container : example-app
@@ -212,14 +212,14 @@ You can now:
212212
```console
213213
$ telepresence connect --docker
214214
Launching Telepresence User Daemon
215-
Connected to context xxx, namespace default (https://&lt;some url&gt;)
216-
$ telepresence ingest example-app --expose 8080 --docker-run -- &lt;your local container&gt;
215+
Connected to context xxx, namespace default (https://<some url>)
216+
$ telepresence ingest example-app --expose 8080 --docker-run -- <your local container>
217217
Using Deployment example-app, container example-app
218-
&lt;output from your local container&gt;
218+
<output from your local container>
219219
```
220220
221221
You can now:
222222
- Code and debug your local container while it interacts with other services in your cluster.
223-
- Send request to your local container using localhost:&lt;local port&gt;
223+
- Send request to your local container using localhost:&lt;local portt&gt;
224224
- Query services only exposed in your cluster's network using `telepresence curl`.
225225
- Set breakpoints in a _Remote Debug_ configuration in your IDE to investigate bugs.

0 commit comments

Comments
 (0)