Telepresence
Tags: telepresence, kubernetes, docker, microservices
Published: 2021-01-20 10:43:31

<b>What is it?</b>

Allows you to run a service on your local machine while also connecting other services on the remote Kubernetes cluster.

<b>Why is it?</b>

It is difficult to test and debug a service in a complex microservice architected applications from you local machine.

For a developer with a machine 16 Gigs of RAM, it is difficult to spin up docker compose or minikube to run all the applications on a local machine. You might just end up heating 🔥 the system.

Often, to complete feature testing we need good amount of traffic hence we deploy the application on a cluster environment with good amount of traffic, named as staging cluster.

From the time you commit the code to it be available on the cluster, it goes through below phases :

1) Compile - to compile and run all the test cases it takes on an average 1-2 mins

2) Build - to build the image it takes on an average 1 min

3) Push - to delete the existing pod and create a new pod with fresh code takes on an average 2-3 mins

So by the time the code it available on cluster, the developer slips a good 4-6 mins on every change made to the code which is to be tested on cluster.

<b>How does it?</b>

Fundamentally, It replaces your pod running in the cluster with a two way network proxy. Essentially swapping out the pod in the cluster with your local development.

Any traffic routed to the service will now be proxied from the kubernetes cluster to the local machine.

Which means your machine is now part of the cluster and is serving the live traffic from the cluster environment.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tgwfkp022f0tsrhu5ogg.png)


Telepresence proxies the environment variables and volumes and TCP connections to your machine. It intercepts DNS so DNS calls and TCP traffic are routed to the cluster through the proxy from your local machine.

<b>Advantage?</b>

Saves individual developer time by quick allowing them to testing their changes with the cluster services.

Helps the developers to locally test/debug and change the service.

It allows to make your local deployment be part of the cluster easily.

<b>Installing telepresence</b>

__OS X __

- `brew cask install osxfuse`

- `brew install datawire/blackbird/telepresence`

__Ubuntu 16.04 or later__

- `curl -s https://packagecloud.io/install/repositories/datawireio/telepresence/script.deb.sh | sudo bash`

- `sudo apt install --no-install-recommends telepresence`

__Windows__

- Install Windows Subsystem for Linux

- Start the BASH.exe program

- Install Telepresence by following the Ubuntu instructions above

To verify you can simply open the terminal and run the telepresence command :


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6ms235bc8l7khya9hrkc.png)


And btw ... its not a penguin ... its a bird. 😉

link for reference -> https://www.telepresence.io


Thank you folks. Please do check my other articles on https://softwareengineeringcrunch.blogspot.com 

If you like my article, you can support me by buying me a coffee ->
 
<a href="https://www.buymeacoffee.com/sn04" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>