Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Develop and Debug Services Locally Against Remote Kubernetes Clusters With Telepresence

DZone's Guide to

Develop and Debug Services Locally Against Remote Kubernetes Clusters With Telepresence

Developing multi-container applications on Kubernetes can be cumbersome. Take a quick look at a popular open source tool, Telepresence, that can help.

· Performance Zone
Free Resource

Learn how real real-time monitoring is critical for DevOps. Because you can't build what you can't see.

Telepresence is an open source tool that lets you run a single service locally, while connecting that service to a remote Kubernetes cluster. This lets developers working on multi-service applications: 

  1. Do fast local development of a single service, even if that service depends on other services in your cluster. Make a change to your service, save, and you can immediately see the new service in action. 

  2. Use any tool installed locally to test/debug/edit your service. For example, you can use a debugger! 

  3. Make your local development machine operate as if it's part of your Kubernetes cluster. If you've got an application on your machine that you want to run against a service in the cluster - it's easy to do. 

Telepresence works on both Mac OX X and Linux, with OS-native packages

How It Works

Telepresence deploys a two-way network proxy in a pod running in your Kubernetes cluster. This pod proxies data from your Kubernetes environment (e.g., TCP connections, environment, variables, volumes) to the local process. The local process has its networking transparently overridden so that DNS calls and TCP connections are routed over the proxy to the remote Kuberntes cluster. 

This approach gives: 

  • Your local service full access to other services in the remote cluster,

  • Your local service full access to Kubernetes environment variables, secrets, and ConfigMap, and

  • Your remote services full access to your local service.

How Telepresence works is discussed in more detail here

Alternatives to Telepresence

Typical alternatives to Telepresence include: 

  • Running your entire multi-service application locally via Docker Compose. This gives you a fast dev/debug cycle. However, it's less realistic since you're not actually running your services inside Kubernetes, and there are cloud services you might use (e.g., a database) that might not be easy to use locally. 

  • Minikube. You can't do live coding/debugging with minikube by itself, but you can with Telepresence. The two work well together. 

  • Run everything in a remote Kubernetes cluster. Again, you can't do live coding/debugging in a remote Kubernetes cluster... but you can with Telepresence. 

Getting Started

There are a number of quick start tutorials on using Telepresence: 

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

Get real-time alerts and visualizations across your cloud infrastructure for real real-time cloud monitoring. Try it FREE now

Topics:
kubernetes ,debugging ,open source ,microservices ,containers ,performance

Published at DZone with permission of Abhay Saxena. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}