# 首次执行telepresence list cli$ telepresence list
Launching Telepresence Daemon v2.3.2 (api v3)Connecting to traffic manager...
Connected to context minikube (https://10.122.101.148:38443)frontend : ready to intercept (traffic-agent not yet installed)redis-follower: ready to intercept (traffic-agent not yet installed)redis-leader : ready to intercept (traffic-agent not yet installed)
$ telepresence list
frontend : ready to intercept (traffic-agent not yet installed)redis-follower: ready to intercept (traffic-agent not yet installed)redis-leader : ready to intercept (traffic-agent not yet installed)
$ curl localhost:18888
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif;}</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
# telepresence intercept <service-name> --port <local-port>[:<remote-port>] --env-file <path-to-env-file>$ telepresence intercept frontend --port 18888:80 --env-file frontend-svc.env
Using Deployment frontend
intercepted
Intercept name : frontend
State : ACTIVE
Workload kind : Deployment
Destination : 127.0.0.1:18888
Service Port Identifier: 80 Volume Mount Error : sshfs is not installed on your local machine
Intercepting : all TCP connections
curl 10.122.101.148:12180 | head -5
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
使用telepresence cli可以查看到服务的拦截状态:
1
2
3
4
5
6
7
8
9
10
$ telepresence list
frontend : intercepted
Intercept name : frontend
State : ACTIVE
Workload kind : Deployment
Destination : 127.0.0.1:18888
Service Port Identifier: 80 Intercepting : all TCP connections
redis-follower: ready to intercept (traffic-agent not yet installed)redis-leader : ready to intercept (traffic-agent not yet installed)
$ telepresence leave frontend
$ telepresence list
frontend : ready to intercept (traffic-agent already installed)redis-follower: ready to intercept (traffic-agent not yet installed)redis-leader : ready to intercept (traffic-agent not yet installed)
$ telepresence intercept frontend --port 18888:80 --env-file frontend-svc.env
To create a preview URL, telepresence needs to know how cluster
ingress works for this service. Please Confirm the ingress to use.
1/4: What's your ingress' layer 3(IP) address?
You may use an IP address or a DNS name (this is usually a
"service.namespace" DNS name).
[default: 10.122.101.148]:
2/4: What's your ingress' layer 4 address (TCP port number)?
[default: 9999]:
3/4: Does that TCP port on your ingress use TLS (as opposed to cleartext)?
[default: n]:
4/4: If required by your ingress, specify a different layer 5 hostname
(TLS-SNI, HTTP "Host" header) to access this service.
[default: frontend.raygecao.com]:
Using Deployment frontend
intercepted
Intercept name : frontend
State : ACTIVE
Workload kind : Deployment
Destination : 127.0.0.1:18888
Service Port Identifier: 80 Volume Mount Error : sshfs is not installed on your local machine
Intercepting : HTTP requests that match all headers:
'x-telepresence-intercept-id: 2da7518d-ce3f-4732-9c02-f144de3443a8:frontend' Preview URL : https://musing-kirch-7616.preview.edgestack.me
Layer 5 Hostname : frontend.raygecao.com