Telepresence2 mainly solves problems

  • Help developers to debug kubernetes and analyze problems;
  • Developers no longer need to run local development inside Kubernetes;
  • Improves real-time collaboration between teams and previews of environment creation;

Telepresence can plug native development applications into the Kubernetes cluster, making the application’s environment look like it’s inside a POD; And in the local development process, can use all k8S internal network services and DNS name;

The working principle of

After telePresence is used, a small proxy is created in the cluster to route traffic back and forth between secure network tunnels.

Inside Kubernetes, you can use the command to view the proxy name.

[root@k8s-master-0 ~]# kubectl get ns
NAME              STATUS   AGE
ambassador        Active   30d
[root@k8s-master-0 ~]# kubectl get all -n ambassador
NAME                                   READY   STATUS    RESTARTS   AGE
pod/traffic-manager-85cb46d955-nhlfr   1/1     Running   0          26h

NAME                      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
service/traffic-manager   ClusterIP   None         <none>        8022/TCP,8081/TCP   26h
1
NAME                              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/traffic-manager   1/1     1            1           26h

NAME                                         DESIRED   CURRENT   READY   AGE
replicaset.apps/traffic-manager-85cb46d955   1         1         1       26h
Copy the code

Quick start

PS: You can view the official documents by yourself

The installation

You can download the latest version from Github. The latest version in use is 2.2.2

#Unpack theTar -zxvf telepresence- 22.2.tar. gz CD telepresence-2.2.2#Setting environment VariablesExport TELEPRESENCE_VERSION=v2.2.2 make build mv./telepresence $GOBIN/telepresenceCopy the code

Install kubectl

Telepresence needs to install agents inside the cluster, so kubectl needs to be installed on the development and development.

After the installation is complete, copy the configuration file from within the Kubenetes cluster;

SCP - r [email protected]: / root /. Kube/config/root /. Kube/config#Perform kubectl 
kubectl get pod
Copy the code

In actual combat

Create test pods within the cluster:

#Create the deploy
kubectl create deploy hello --image=luksa/kubia
#Exposed services
kubectl expose deploy hello --port 80 --target-port 8080
Copy the code

Telepresence2 commands include:

Available Commands: Session Commands: Login to login to the Ambassador Cloud# no need to logout of the Ambassador Cloud# no need to use the license to obtain version information View the connection status quit Exit Traffic Commands: list List of services that can be intercepted Intercept a service Leave Exit intercept service preview Other Commands: Version View version uninstall Uninstall proxy plug-in dashboard in the cluster Open a dashboard(networking required) current-cluster-idCopy the code

Connect the cluster

Telepresence connect Launching Telepresence Daemon V2.3.2 (API V3) Connecting to Traffic Manager... Connected to context kubernetes-admin@kubernetes (https://<clusterip>:6443)Copy the code

Viewing Connection Status

# telepresence statusRoot Daemon: Running Version: v2.3.2 (API 3) DNS: "" User Daemon: Running Version: v2.3.2 (API 3) Ambassador Cloud: Logged out Status : Connected Kubernetes server : https://cluster-ip:6443 Kubernetes context: kubernetes-admin@kubernetes Telepresence proxy: ON (networking to the cluster is enabled) Intercepts : 0 totalCopy the code

View the current services that can be blocked

# telepresence list --namespace default
nginx-demo: ready to intercept (traffic-agent not yet installed)
Copy the code

— Namespace specifies the k8S namespace;

It is displayed by default according to kubectl configuration;

Access services within the cluster

[root@localhost bin]# curl hello.platform/
You've hit hello-66cff46dc-khm9q
Copy the code

Intercept services on the native

[Existing problems, future updates]

FAQ

  • During the installation, some operations may time out, for example:
telepresence: error: connector.Connect: the traffic manager gRPC API timed out.  The current timeout 15s can be configured as "timeouts.trafficManagerAPI" in "/root/.config/telepresence/config.yml"
rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /tmp/telepresence-connector.socket: connect: connection refused"
Copy the code

According to the message, the API of the request agent times out. You can change the timeout period by asking the message.

  • The following error occurs during application access:
[root@localhost telepresence-2.2.2]# curl http://hello.platform
curl: (56) Recv failure: Connection reset by peer
Copy the code

You can check whether SVC resources are running correctly.