How to connect Pod in K8S cluster with local network for debugging

How to connect Pod in K8S cluster with local network for debugging

[[404039]]

Preface

As we all know, when there is no K8S cluster, we can directly connect to the test environment service to debug. With the arrival of K8S, we can no longer directly connect to the business service to debug. The IP address assigned to the K8S Pod is the internal network of the cluster, and the external network of the cluster cannot directly access the Pod. So what is a good solution to directly connect to the Pod? The following introduces open source Telepresence.

Introduction to Telepresence

Telepresence is an open source tool that allows you to run a single service locally while connecting that service to a remote Kubernetes cluster. This enables developers building multi-service applications to:

  • Do rapid local development on a single service, even if that service depends on other services in the cluster. Make changes to your service, save, and you can instantly see the new service running.
  • Use whatever tools you have installed locally to test/debug/edit your service. For example, you can use a debugger or an IDE!
  • Make your local development machine run as if it were part of a Kubernetes cluster. If you have an application on your machine that you want to run against a service in the cluster - this is easy to do.

Open source address: https://github.com/telepresenceio/telepresence

How Telepresence Works

Telepresence deploys a bidirectional 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 local processes. The local process's network is transparently overlaid so that DNS calls and TCP connections are routed through the proxy to the remote Kubernetes cluster.

This approach gives:

  • Your local services have full access to other services in the remote cluster
  • Full access to your local services for Kubernetes environments, secrets, and ConfigMaps
  • Your remote service has full access to your local service

Telepresence Supported Platforms

  • Mac OS X
  • Linux

Telepresence Installation

Can be installed using Homebrew, apt or dnf

Telepresence Usage Report

Telepresence collects some basic information about its users so that it can send important customer notifications, such as new version availability and security announcements. We also use this information to anonymously aggregate basic usage analytics. To disable this behavior, set the environment variable SCOUT_DISABLE:

  1. export SCOUT_DISABLE=1

How to use Telepresence

I won’t describe it here. For details, please refer to https://www.telepresence.io/tutorials/kubernetes

Reference Links

  • https://github.com/telepresenceio/telepresence
  • https://www.telepresence.io/discussion/overview

<<:  Airplanes are all equipped with 5G, so why is the signal on high-speed trains still so poor?

>>:  China's 6G network will be commercially available in 2030 to help realize the "intelligent connection of all things"

Recommend

How to design a distributed ID generator?

Hello everyone, I am Brother Shu. In complex dist...

Without 5G performance guarantees, can operators fully exploit this opportunity?

Private 5G networks are attractive to the largest...

These five points cannot be ignored when selecting enterprise SD-WAN!

As the main theme of today's IT industry, clo...

Huawei's Liang Hua: Give machines intelligence and services a platform

On August 23, Liang Hua, Chairman of Huawei, atte...

Will 2019 be the first year of 5G? The three major operators: Not happening!

In 2019, people inside and outside the industry s...

HOSTEROID: €2.1/month KVM-512MB/10GB/324GB/Vienna & New Jersey & London

HOSTEROID is a foreign hosting company founded in...

Mobile networks want to kill WiFi, but it won’t work in China

According to a recent report by OpenSignal Mobile...

...

How Fiber-to-the-Home Broadband Revolutionized Internet Connectivity

The internet has become an integral part of our l...