telepresenceio / telepresence

Local development against a remote Kubernetes or OpenShift cluster
https://www.telepresence.io
Other
6.52k stars 513 forks source link

Telepresence fails to swap Deployment when VPN present but not connected #1432

Closed mgoltzsche closed 2 weeks ago

mgoltzsche commented 4 years ago

What were you trying to do?

I wanted to make a local process accessible from within a k3d cluster by replacing a Deployment. I turned off my VPN but telepresence apparently still attempts to use it.

What did you expect to happen?

The port specified within the Deployment should be forwarded to the same port on localhost and the process I specified that should serve the port on localhost should be run. When VPN is disabled I'd expect it to use the non-VPN route.

What happened instead?

It crashed while attempting to forward the port due to vpn-tcp tunnel did not connect while the VPN connection was disabled. The same error appears both when the VPN is enabled and when it is disabled.

Automatically included information

Command line: ['/usr/bin/telepresence', '--swap-deployment', 'mydeployment', '--run', './bin/start.sh', 'injector'] Version: 0.107 Python version: 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0] kubectl version: Client Version: v1.16.8 // Server Version: v1.14.6-k3s.1 oc version: (error: [Errno 2] No such file or directory: 'oc': 'oc') OS: Linux max-ThinkPad-T480 5.4.0-47-generic #51~18.04.1-Ubuntu SMP Sat Sep 5 14:35:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Traceback (most recent call last):
  File "/usr/bin/telepresence/telepresence/cli.py", line 135, in crash_reporting
    yield
  File "/usr/bin/telepresence/telepresence/main.py", line 82, in main
    runner, remote_info, env, socks_port, ssh, mount_dir, pod_info
  File "/usr/bin/telepresence/telepresence/outbound/setup.py", line 112, in launch
    runner_, remote_info, command, args.also_proxy, env, ssh
  File "/usr/bin/telepresence/telepresence/outbound/local.py", line 126, in launch_vpn
    connect_sshuttle(runner, remote_info, also_proxy, ssh)
  File "/usr/bin/telepresence/telepresence/outbound/vpn.py", line 110, in connect_sshuttle
    raise RuntimeError("vpn-tcp tunnel did not connect")
RuntimeError: vpn-tcp tunnel did not connect

Logs:

("hellotelepresence-85")'
  37.9 TEL | [194] exit 1 in 0.17 secs.
  37.9 TEL | [195] Capturing: python3 -c 'import socket; socket.gethostbyname("hellotelepresence-85.a.sanity.check.telepresence.io")'
  38.1 TEL | [195] exit 1 in 0.22 secs.
  38.2 TEL | Wait for vpn-tcp connection: hellotelepresence-86
  38.2 TEL | [196] Capturing: python3 -c 'import socket; socket.gethostbyname("hellotelepresence-86")'
  38.4 TEL | [196] exit 1 in 0.17 secs.
  38.4 TEL | [197] Capturing: python3 -c 'import socket; socket.gethostbyname("hellotelepresence-86.a.sanity.check.telepresence.io")'
  38.6 TEL | [197] exit 1 in 0.22 secs.
  38.7 TEL | Wait for vpn-tcp connection: hellotelepresence-87
  38.7 TEL | [198] Capturing: python3 -c 'import socket; socket.gethostbyname("hellotelepresence-87")'
  38.8 TEL | [198] exit 1 in 0.17 secs.
  38.8 TEL | [199] Capturing: python3 -c 'import socket; socket.gethostbyname("hellotelepresence-87.a.sanity.check.telepresence.io")'
  39.1 TEL | [199] exit 1 in 0.22 secs.
mgoltzsche commented 4 years ago

It kind of worked using --method=inject-tcp but then my local process the port should be forwarded to failed to run due to permission issues when creating the socket - apparently because some network manipulating library is injected that requires privileges. Eventually it would work when the process is run as root but using sudo is also not allowed for some reason and would have caused other problems so that I gave up on this for now.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in 7 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 7 days with no activity.