6 min • read

Telepresence Quick Start - Go

This guide provides you with a hands-on tutorial with Telepresence and Golang. To go through this tutorial, the only thing you'll need is a computer that runs Docker Desktop >=20.10.7. We'll give you a pre-configured remote Kubernetes cluster and a Docker container to run locally.

If you don't have Docker Desktop already installed, go to the Docker download page and install Docker.

1. Get a free remote cluster

Telepresence connects your local workstation with a remote Kubernetes cluster. In this tutorial, you'll start with a pre-configured, remote cluster.

  1. Get a Free Remote Cluster
    Sign in to Ambassador Cloud to activate your demo cluster.
  2. 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.
Wait! The rest of this quick start requires a remote Kubernetes cluster. Before continuing, activate a free demo cluster in step 1 above.

2. Try the Emojivoto application

The remote cluster is running the Emojivoto application, which consists of four services. Test out the application:

  1. Go to the Emojivoto webapp and vote for some emojis.

  2. Now, click on the 🍩 emoji. You'll see that a bug is present, and voting 🍩 doesn't work.

3. Run the Docker container

The bug is present in the voting-svc service, you'll run that service locally. To save your time, we prepared a Docker container with this service running and all you'll need to fix the bug.

  1. Run the Docker container locally, by running this command inside your local terminal:

    GNU/Linux
    macOS
    Windows
  2. The application is failing due to a little bug inside this service which uses gRPC to communicate with the others services. We can use grpcurl to test the gRPC endpoint and see the error by running:

  3. In order to fix the bug, use the Docker container's embedded IDE to fix this error. Go to http://localhost:8083 and open api/api.go. Remove the "fmt" package by deleting the line 5.

    and also replace the line 21:

    with

    Then save the file (Ctrl+s for Windows, Cmd+s for Mac or Menu -> File -> Save) and verify that the error is fixed now:

4. Telepresence intercept

  1. Now the bug is fixed, you can use Telepresence to intercept all the traffic through our local service. Run the following command inside the container:

    Now you can go back to Emojivoto webapp and you'll see that voting for 🍩 woks as expected.

You have created an intercept to tell Telepresence where to send traffic. The voting-svc traffic is now destined to the local Dockerized version of the service. This intercepts all the traffic to the local voting-svc service, which has been fixed with the Telepresence intercept.

5. Telepresence intercept with a preview URL

Preview URLs allows you to safely share your development environment. With this approach, you can try and test your local service more accurately because you have a total control about which traffic is handled through your service, all of this thank to the preview URL.

  1. First leave the current intercept:

  2. Then login to telepresence:

  3. Create an intercept, which will tell Telepresence to send traffic to the service in our container instead of the service in the cluster.

    When prompted for ingress configuration, you need to enter edge-stack.ambassador as your DNS for the first and last questions. For the remaining questions, the default values are correct.

  4. If you access the Emojivoto webapp application on your remote cluster and vote for the 🍩 emoji, you'll see the bug is still present.

  5. Vote for the 🍩 emoji using the Preview URL obtained in the previous step, and you will see that the bug is fixed, since traffic is being routed to the fixed version which is running locally.

logo What's Next?

You've intercepted a service in one of our demo clusters, now you can use Telepresence to intercept a service in your own environment!