- What is Telepresence Docker Mode?
- Key Benefits
- 1. Get a free remote cluster
- 2. Try the Emojivoto application
- 3. Testing the fix in your local environment
- 4. Download the demo cluster config file
- 5. Enable Telepresence Docker mode
- 6. Set up your local development environment and make a global intercept
- 7.Make a personal intercept)
Welcome to the quickstart guide for Telepresence Docker mode! In this hands-on tutorial, we will explore the powerful features of Telepresence and learn how to leverage Telepresence Docker mode to enhance local development and debugging workflows.
Telepresence Docker Mode enables you to run a single service locally while seamlessly connecting it to a remote Kubernetes cluster. This mode enables developers to accelerate their development cycles by providing a fast and efficient way to iterate on code changes without requiring admin access on their machines.
When using Telepresence in Docker mode, you can enjoy the following benefits:
Simplified Development Setup: Eliminate the need for admin access on your local machine, making it easier to set up and configure your development environment.
Efficient Networking: Address common networking challenges by seamlessly connecting your locally running service to a remote Kubernetes cluster. This enables you to leverage the cluster's resources and dependencies while maintaining a productive local development experience.
Enhanced Debugging: Gain the ability to debug your service in its natural environment, directly from your local development environment. This eliminates the need for complex workarounds or third-party applications to enable volume mounts or access remote resources.
Kubectl. Kubectl is the official Kubernetes command-line tool. You will use it regularly to interact with your cluster, whether deploying applications, inspecting resources, or debugging issues.
Telepresence 2.13 or latest. Telepresence is a command-line tool that lets you run a single service locally, while connecting that service to a remote Kubernetes cluster. You can use Telepresence to speed up local development and debugging.
Docker Desktop. Docker Desktop is a tool for building and sharing containerized applications and microservices. You'll use Docker Desktop to run a local development environment.
Now that we have a clear understanding of Telepresence Docker mode and its benefits, let's dive into the hands-on tutorial!
Telepresence connects your local workstation with a remote Kubernetes cluster. In this tutorial, we'll start with a pre-configured, remote cluster.
- Get a Free Remote Cluster
Sign in to Ambassador Cloud to activate your demo cluster.
- Go to the Service Catalog to see all the services deployed on your cluster.The Service Catalog gives you a consolidated view of all your services across development, staging, and production. After exploring the Service Catalog, continue with this tutorial to test the application in your demo cluster.
The remote cluster is running the Emojivoto application, which consists of four services. Test out the application:
Go to the remote demo cluster and vote for some emojis.
Now, click on the 🍩 emoji. You'll see that a bug is present, and voting 🍩 doesn't work. We're going to use Telepresence shortly to fix this bug, as everyone should be able to vote for 🍩!
We'll set up a development environment locally on your workstation. We'll then use Telepresence to connect this local development environment to the remote Kubernetes cluster. To save time, the development environment we'll use is pre-packaged as a Docker container.
Download and run the image for the service locally:
The Docker container includes a copy of the Emojivoto application that fixes the bug. Visit the leaderboard and notice how it is different from the leaderboard in your Kubernetes cluster.
Now, stop the container by running the following command in your terminal:
In this section of the quickstart, you ran the Emojivoto application locally. In the next section, you'll use Telepresence to connect your local development environment to the remote Kubernetes cluster.
- Download your demo cluster config file. This file contains the credentials you need to access your demo cluster.
Export the file's location to KUBECONFIG by running this command in your terminal:
You should now be able to run
kubectl commands against your demo cluster.
Verify that you can access the cluster by listing the app's services:
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.
Confirm that the Telepresence CLI is now installed, we expect to see that the daemons are not yet running:
Log in to Ambassador Cloud:
Then, install the Helm chart and quit Telepresence:
Finally, connect to the remote cluster using Docker mode:
Verify that you are connected to the remote cluster by listing your Docker containers:
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 your intercept handler (interceptor) by targeting the daemon container --network=container:tp-
<your-context>, and open the preview URL to see the traffic routed to your machine.
Run the Docker container locally, by running this command inside your local terminal. The image is the same as the one you ran in the previous step (step 1) but this time, you will run it with the
With Telepresence, you can create global intercepts that intercept all traffic going to a service in your cluster and route it to your local environment instead/ Start a global intercept by running this command in your terminal:
Personal intercepts allow you to be selective and intercept only some of the traffic to a service while not interfering with the rest of the traffic. This allows you to share a cluster with others on your team without interfering with their work.
First, connect to telepresence docker mode again:
Run the docker container again:
Create a personal intercept by running this command in your terminal:
Open the preview URL to see the traffic routed to your machine.
To stop the intercept, run this command in your terminal:
You've intercepted a service in one of our demo clusters, now you can use Telepresence to intercept a service in your own environment!
ON THIS PAGE
- What is Telepresence Docker Mode?
- Key Benefits
- Get a free remote cluster
- Try the Emojivoto application
- Testing the fix in your local environment
- Download the demo cluster config file
- Enable Telepresence Docker mode
- Set up your local development environment and make a global intercept
- Make a personal intercept
- What's Next?