Skip to content

Commit

Permalink
Add documentation for 2.20.
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Hallgren <[email protected]>
  • Loading branch information
thallgren committed Oct 3, 2024
1 parent 50b3f8f commit a94c8a7
Show file tree
Hide file tree
Showing 59 changed files with 6,138 additions and 0 deletions.
23 changes: 23 additions & 0 deletions versioned_docs/version-2.20/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Telepresence Documentation

This folder contains the Telepresence documentation in a format suitable for a versioned folder in the
telepresenceio/telepresence.io repository. The folder will show up in that repository when a new minor revision
tag is created here.

Assuming that a 2.20.0 release is pending, and that a release/v2.20.0 branch has been created, then:
```console
$ export TELEPRESENCE_VERSION=v2.20.0
$ make prepare-release
$ git push origin {,rpc/}v2.20.0 release/v2.20.0
```

will result in a `docs/v2.20` folder with this folder's contents in the telepresenceio/telepresence.io repository.

Subsequent bugfix tags for the same minor tag, i.e.:
```console
$ export TELEPRESENCE_VERSION=v2.20.1
$ make prepare-release
$ git push origin {,rpc/}v2.20.1 release/v2.20.1
```
will not result in a new folder when it is pushed, but it will update the content of the `docs/v2.20` folder to
reflect this folder's content for that tag.
45 changes: 45 additions & 0 deletions versioned_docs/version-2.20/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
description: Main menu when using plain markdown. Excluded when generating the website
---
# <img src="images/logo.png" height="64px"/> Telepresence Documentation
raw markdown version, more bells and whistles at [telepresence.io](https://telepresence.io)

- [Quick start](quick-start.md)
- Install Telepresence
- [Install Client](install/client.md)
- [Upgrade Client](install/upgrade.md)
- [Install Traffic Manager](install/manager.md)
- [Cloud Provider Prerequisites](install/cloud.md)
- Core concepts
- [The developer experience and the inner dev loop](concepts/devloop.md)
- [Making the remote local: Faster feedback, collaboration and debugging](concepts/faster.md)
- [Using Telepresence with Docker](concepts/docker.md)
- [Intercepts](concepts/intercepts.md)
- How do I...
- [Intercept a service in your own environment](howtos/intercepts.md)
- [Proxy outbound traffic to my cluster](howtos/outbound.md)
- [Work with large clusters](howtos/large-clusters.md)
- [Host a cluster in a local VM](howtos/cluster-in-vm.md)
- Technical reference
- [Architecture](reference/architecture.md)
- [Client reference](reference/client.md)
- [Laptop-side configuration](reference/config.md)
- [Cluster-side configuration](reference/cluster-config.md)
- [Using Docker for intercepts](reference/docker-run.md)
- [Running Telepresence in a Docker container](reference/inside-container.md)
- [Environment variables](reference/environment.md)
- Intercepts
- [Configure intercept using CLI](reference/intercepts/cli.md)
- [Traffic Agent Sidecar](reference/intercepts/sidecar.md)
- [Volume mounts](reference/volume.md)
- [DNS resolution](reference/dns.md)
- [RBAC](reference/rbac.md)
- [Telepresence and VPNs](reference/vpn.md)
- [Networking through Virtual Network Interface](reference/tun-device.md)
- [Connection Routing](reference/routing.md)
- [Monitoring](reference/monitoring.md)
- [FAQs](faqs.md)
- [Troubleshooting](troubleshooting.md)
- [Community](community.md)
- [Release Notes](release-notes.md)
- [Licenses](licenses.md)
13 changes: 13 additions & 0 deletions versioned_docs/version-2.20/community.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Community
hide_table_of_contents: true
---

# Community

## Contributor's guide
Please review our [contributor's guide](https://github.com/telepresenceio/telepresence/blob/release/v2/CONTRIBUTING.md)
on GitHub to learn how you can help make Telepresence better.

## Meetings
Check out our community [meeting schedule](https://github.com/telepresenceio/telepresence/blob/release/v2/MEETING_SCHEDULE.md) for opportunities to interact with Telepresence developers.
55 changes: 55 additions & 0 deletions versioned_docs/version-2.20/concepts/devloop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: The developer experience and the inner dev loop
hide_table_of_contents: true
---

# The developer experience and the inner dev loop

## How is the developer experience changing?

The developer experience is the workflow a developer uses to develop, test, deploy, and release software.

Typically this experience has consisted of both an inner dev loop and an outer dev loop. The inner dev loop is where the individual developer codes and tests, and once the developer pushes their code to version control, the outer dev loop is triggered.

The outer dev loop is _everything else_ that happens leading up to release. This includes code merge, automated code review, test execution, deployment, controlled (canary) release, and observation of results. The modern outer dev loop might include, for example, an automated CI/CD pipeline as part of a GitOps workflow and a progressive delivery strategy relying on automated canaries, i.e. to make the outer loop as fast, efficient and automated as possible.

Cloud-native technologies have fundamentally altered the developer experience in two ways: one, developers now have to take extra steps in the inner dev loop; two, developers need to be concerned with the outer dev loop as part of their workflow, even if most of their time is spent in the inner dev loop.

Engineers now must design and build distributed service-based applications _and_ also assume responsibility for the full development life cycle. The new developer experience means that developers can no longer rely on monolithic application developer best practices, such as checking out the entire codebase and coding locally with a rapid “live-reload” inner development loop. Now developers have to manage external dependencies, build containers, and implement orchestration configuration (e.g. Kubernetes YAML). This may appear trivial at first glance, but this adds development time to the equation.

## What is the inner dev loop?

The inner dev loop is the single developer workflow. A single developer should be able to set up and use an inner dev loop to code and test changes quickly.

Even within the Kubernetes space, developers will find much of the inner dev loop familiar. That is, code can still be written locally at a level that a developer controls and committed to version control.

In a traditional inner dev loop, if a typical developer codes for 360 minutes (6 hours) a day, with a traditional local iterative development loop of 5 minutes — 3 coding, 1 building, i.e. compiling/deploying/reloading, 1 testing inspecting, and 10-20 seconds for committing code — they can expect to make ~70 iterations of their code per day. Any one of these iterations could be a release candidate. The only “developer tax” being paid here is for the commit process, which is negligible.

![traditional inner dev loop](../images/trad-inner-dev-loop.png#devloop)

## In search of lost time: How does containerization change the inner dev loop?

The inner dev loop is where writing and testing code happens, and time is critical for maximum developer productivity and getting features in front of end users. The faster the feedback loop, the faster developers can refactor and test again.

Changes to the inner dev loop process, i.e., containerization, threaten to slow this development workflow down. Coding stays the same in the new inner dev loop, but code has to be containerized. The _containerized_ inner dev loop requires a number of new steps:

* packaging code in containers
* writing a manifest to specify how Kubernetes should run the application (e.g., YAML-based configuration information, such as how much memory should be given to a container)
* pushing the container to the registry
* deploying containers in Kubernetes

Each new step within the container inner dev loop adds to overall development time, and developers are repeating this process frequently. If the build time is incremented to 5 minutes — not atypical with a standard container build, registry upload, and deploy — then the number of possible development iterations per day drops to ~40. At the extreme that’s a 40% decrease in potential new features being released. This new container build step is a hidden tax, which is quite expensive.


![container inner dev loop](../images/container-inner-dev-loop.png#devloop)

## Tackling the slow inner dev loop

A slow inner dev loop can negatively impact frontend and backend teams, delaying work on individual and team levels and slowing releases into production overall.

For example:

* Frontend developers have to wait for previews of backend changes on a shared dev/staging environment (for example, until CI/CD deploys a new version) and/or rely on mocks/stubs/virtual services when coding their application locally. These changes are only verifiable by going through the CI/CD process to build and deploy within a target environment.
* Backend developers have to wait for CI/CD to build and deploy their app to a target environment to verify that their code works correctly with cluster or cloud-based dependencies as well as to share their work to get feedback.

New technologies and tools can facilitate cloud-native, containerized development. And in the case of a sluggish inner dev loop, developers can accelerate productivity with tools that help speed the loop up again.
108 changes: 108 additions & 0 deletions versioned_docs/version-2.20/concepts/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: "Using Telepresence with Docker"
hide_table_of_contents: true
---
# Telepresence with Docker Golden Path

## Why?

It can be tedious to adopt Telepresence across your organization, since in its handiest form, it requires admin access, and needs to get along with any exotic
networking setup that your company may have.

If Docker is already approved in your organization, this Golden path should be considered.

## How?

When using Telepresence in Docker mode, users can eliminate the need for admin access on their machines, address several networking challenges, and forego the need for third-party applications to enable volume mounts.

You can simply add the docker flag to any Telepresence command, and it will start your daemon in a container.
Thus removing the need for root access, making it easier to adopt as an organization

Let's illustrate with a quick demo, assuming a default Kubernetes context named default, and a simple HTTP service:

```cli
$ telepresence connect --docker
Connected to context default (https://default.cluster.bakerstreet.io)
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7a0e01cab325 datawire/telepresence:2.12.1 "telepresence connec…" 18 seconds ago Up 16 seconds 127.0.0.1:58802->58802/tcp tp-default
```

This method limits the scope of the potential networking issues since everything stays inside Docker. The Telepresence daemon can be found under the name `tp-<your-context>` when listing your containers.

Start an intercept and a corresponding intercept-handler:

```cli
$ telepresence intercept echo-easy --port 8080:80 --docker-run -- jmalloc/echo-server
Using Deployment echo-easy
Intercept name : echo-easy
State : ACTIVE
Workload kind : Deployment
Destination : 127.0.0.1:8080
Service Port Identifier: proxied
Intercepting : all TCP requests
Echo server listening on port 8080.
```

Using `--docker-run` starts the local container that acts as the intercept handler so that it uses the same network as the container that runs the telepresence daemon. It will also
have the remote volumes mounted in the same way as the remote container that it intercepts.

If you want to curl your remote service, you'll need to do that from a container that shares the daemon container's network. You can find the network using `telepresence status`:
```cli
$ telepresence status | grep 'Container network'
Container network : container:tp-default-default-cn
```

Now curl with a `docker run` that uses that network:
```cli
$ docker run --network container:tp-default-default-cn --rm curlimages/curl echo-easy
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 99 100 99 0 0 21104 0 --:--:-- --:--:-- -Request served by 4b225bc8d6f1
GET / HTTP/1.1
Host: echo-easy
Accept: */*
User-Agent: curl/8.6.0
-:--:-- 24750
```

Similarly, if you want to start your intercept handler manually using `docker run`, you must ensure that it shares the daemon container's network:

```cli
$ docker run \
--network=container:tp-default \
-e PORT=8080 jmalloc/echo-server
Echo server listening on port 8080.
```

### Tip. Use named connections
You can use the `--name` flag to name the connection and get a shorter network name:

```
$ telepresence quit
$ telepresence connect --docker --name a
```
Now, the network name will be `tp-a` instead of `tp-default-default-cn`.

Naming is also very useful when you want to connect to several namespaces simultaneously, e.g.

```
$ telepresence connect --docker --name alpha --namespace alpha
$ telepresence connect --docker --name beta --namespace beta
```

Now, with two connections active, you must pass the flag `--use <name pattern>` to other commands, e.g.
```
$ telepresence intercept echo-easy --use alpha --port 8080:80 --docker-run -- jmalloc/echo-server
```

## Key learnings

* Using the Docker mode of telepresence **does not require root access**, and makes it **easier** to adopt it across your organization.
* It **limits the potential networking issues** you can encounter.
* It **limits the potential mount issues** you can encounter.
* It **enables simultaneous intercepts in multiple namespaces**.
* It leverages **Docker** for your interceptor.
31 changes: 31 additions & 0 deletions versioned_docs/version-2.20/concepts/faster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Making the remote local: Faster feedback, collaboration and debugging"
hide_table_of_contents: true
---

---
# Making the remote local: Faster feedback, collaboration and debugging

With the goal of achieving fast, efficient development, developers need a set of approaches to bridge the gap between remote Kubernetes clusters and local development, and reduce time to feedback and debugging.

## How should I set up a Kubernetes development environment?

Setting up a development environment for Kubernetes can be much more complex than the setup for traditional web applications. Creating and maintaining a Kubernetes development environment relies on a number of external dependencies, such as databases or authentication.

While there are several ways to set up a Kubernetes development environment, most introduce complexities and impediments to speed. The dev environment should be set up to easily code and test in conditions where a service can access the resources it depends on.

A good way to meet the goals of faster feedback, possibilities for collaboration, and scale in a realistic production environment is the "single service local, all other remote" environment. Developing in a fully remote environment offers some benefits, but for developers, it offers the slowest possible feedback loop. With local development in a remote environment, the developer retains considerable control while using tools like [Telepresence](../quick-start.md) to facilitate fast feedback, debugging and collaboration.

## What is Telepresence?

Telepresence is an open source tool that lets developers [code and test microservices locally against a remote Kubernetes cluster](../quick-start.md). Telepresence facilitates more efficient development workflows while relieving the need to worry about other service dependencies.

## How can I get fast, efficient local development?

The dev loop can be jump-started with the right development environment and Kubernetes development tools to support speed, efficiency and collaboration. Telepresence is designed to let Kubernetes developers code as though their laptop is in their Kubernetes cluster, enabling the service to run locally and be proxied into the remote cluster. Telepresence runs code locally and forwards requests to and from the remote Kubernetes cluster, bypassing the much slower process of waiting for a container to build, pushing it to registry, and deploying to production.

A rapid and continuous feedback loop is essential for productivity and speed; Telepresence enables the fast, efficient feedback loop to ensure that developers can access the rapid local development loop they rely on without disrupting their own or other developers' workflows. Telepresence safely intercepts traffic from the production cluster and enables near-instant testing of code and local debugging in production.

Telepresence works by deploying a two-way network proxy in a pod running in a Kubernetes cluster. This pod proxies data from the Kubernetes environment (e.g., TCP/UDP connections, environment variables, volumes) to the local process. This proxy can intercept traffic meant for the service and reroute it to a local copy, which is ready for further (local) development.

The intercept proxy works thanks to context propagation, which is most frequently associated with distributed tracing but also plays a key role in controllable intercepts.
64 changes: 64 additions & 0 deletions versioned_docs/version-2.20/concepts/intercepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "Intercepts"
description: "Short demonstration of global intercepts"
hide_table_of_contents: true
---

import Admonition from '@theme/Admonition';
import Paper from '@mui/material/Paper';
import Tab from '@mui/material/Tab';
import TabContext from '@mui/lab/TabContext';
import TabList from '@mui/lab/TabList';
import TabPanel from '@mui/lab/TabPanel';
import TabsContainer from '@site/src/components/TabsContainer';
import Animation from '@site/src/components/InterceptAnimation';

<TabsContainer>
<TabPanel className="TabBody" value="regular">

# No intercept

<Paper className="interceptTab">
<Animation className="mode-regular" />

This is the normal operation of your cluster without Telepresence.

</Paper>
</TabPanel>
<TabPanel className="TabBody" value="global">

<Paper className="interceptTab">

# Intercept

<Animation className="mode-global" />

**Intercepts** replace the Kubernetes "Orders" service with the
Orders service running on your laptop. The users see no change, but
with all the traffic coming to your laptop, you can observe and debug
with all your dev tools.

### Creating and using intercepts

1. Creating the intercept: Intercept your service from your CLI:

```shell
telepresence intercept SERVICENAME
```

<Admonition className="alert" type="info">

Make sure your current kubectl context points to the target
cluster. If your service is running in a different namespace than
your current active context, use or change the `--namespace` flag.

</Admonition>

2. Using the intercept: Send requests to your service:

All requests will be sent to the version of your service that is
running in the local development environment.

</Paper>
</TabPanel>
</TabsContainer>
Loading

0 comments on commit a94c8a7

Please sign in to comment.