This quickstart provides the fastest way to get an understanding of how Telepresence can speed up your development in Kubernetes within docker. It should take you about 5-10 minutes. You'll create a local cluster using Kind with a sample app installed, and use Telepresence to redirect traffic from a workload in your cluster to a local docker image.
You will also need Docker installed.
We offer an easy installation path using an MSI Installer. However if you'd like to setup Telepresence using Powershell, you can run these commands:
We provide a repo that sets up a local cluster for you
with the in-cluster Telepresence components and a sample app already installed. It does not need
Run as Administrator privileges.
Connect to the cluster:
telepresence connect --docker --namespace <namespace>
Normally, Telepresence would provide cluster dns for your browser, but, in docker mode, the telepresence daemons are running inside docker; Telepresence is only providing cluster dns to that docker network. To open our app in a browser, we will need to use kubectl to connect to it. Port-forward a connection to the ingress in the demo cluster:
kubectl port-forward service/verylargejavaservice 8080:8080
Open the app in your browser by typing http://localhost:8080/ into the search bar.
You are connected to the VeryLargeJavaService, which talks to the DataProcessingService as an upstream dependency. The DataProcessingService in turn has a dependency on VeryLargeDatastore.
Historically, when developing microservices with Kubernetes, your choices have been to run an entire set of services in a cluster or namespace just for you, and spend 15 minutes on every one-line change, pushing the code, waiting for it to build, waiting for it to deploy, etc. Or, you could run all 50 services in your environment on your laptop, and be deafened by the fans.
With Telepresence, you can intercept traffic from a service in the cluster and route it to your laptop, effectively replacing the cluster version
with your local development environment. This gives you back the fast feedback loop of local development, and access to your preferred tools like your favorite IDE or debugger.
And you still have access to all the cluster resources via
telepresence connect. Now you'll see this in action.
Next, we’ll create an intercept. An intercept is a rule that tells Telepresence where to send traffic. In this example, we will send all traffic destined for the DataProcessingService to the version of the DataProcessingService running locally instead:
Start the intercept with the
interceptcommand, setting the service name and port:
telepresence intercept --port <local port>:<service port> <workload name> --docker-run -- <docker run flags> <image name> <image flags>
Go to the frontend service again in your browser and refresh (if you closed the
port-forwardfrom step 3, you will have to re-start it). You will now see the blue elements in the app.