DEV Community

kelseyevans for Datawire

Posted on

3

Connect to a Remote Kubernetes Cluster with Telepresence

In this tutorial you'll see how Telepresence allows you to get transparent access to a remote cluster from a local process.
This allows you to use your local tools on your laptop to communicate with processes inside the cluster.

You should start by running a service in the cluster:

$ kubectl run myservice --image=datawire/hello-world --port=8000 --expose
$ kubectl get service myservice
NAME        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
myservice   10.0.0.12    <none>        8000/TCP   1m

It may take a minute or two for the pod running the server to be up and running, depending on how fast your cluster is.

You can now run a local process using Telepresence that can access that service, even though the process is local but the service is running in the Kubernetes cluster:

$ telepresence --run curl http://myservice:8000/
Hello, world!

(This will not work if the hello world pod hasn't started yet... if so, try again.)

What's going on:

  1. Telepresence creates a new Deployment, which runs a proxy.
  2. Telepresence runs curl locally in a way that proxies networking through that Deployment.
  3. The DNS lookup and HTTP request done by curl get routed through the proxy and transparently access the cluster... even though curl is running locally.
  4. When curl exits the new Deployment will be cleaned up.

To learn more about what Telepresence proxies you can read the relevant reference documentation.

Additional Resources

If you're interested in trying Telepresence on your own, you can install locally with Homebrew, apt, or dnf.

Or check out these other tutorials

Have questions? Ask in the Telepresence Gitter chatroom or file an issue on GitHub.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

If you found this post useful, consider leaving a ❤️ or a nice comment!

Got it