telepresenceio / telepresence

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

sshfs won't work inside WSL on Windows, or inside Docker by default #115

Closed itamarst closed 5 years ago

itamarst commented 7 years ago

Telepresence works in Windows Subsystem for Linux or inside a Docker container, but sshfs won't. As a workaround to allow at least partial support I'm going to continue running and just warn that volumes aren't available, but it would be good to have volume support where sshfs can't run.

The solution is probably to fallback to copying files, which will work if we limit ourselves only to Secret, ConfigMap and /var/run/secrets volumes, which should cover most use cases.

ark3 commented 6 years ago

For the container method, we can switch to using this Docker plugin:

https://github.com/vieux/docker-volume-sshfs

That would have other benefits, such as avoiding a sudo.

Disturbing commented 6 years ago

Mind sharing the steps of how you got it to work in windows?

Right now I'm seeing errors during the install of telepresence via apt-get.

ark3 commented 6 years ago

We have not tested on Windows in quite a while, so our support may have... atrophied. Can you copy-paste the installation output in a new issue, please?

JCMais commented 6 years ago

Just tried running it on WSL, got this error, I just tried to run a command inside a service (inside a Cluster): telepresence --run curl blah

T: Starting proxy with method 'vpn-tcp', which has the following limitations: All processes are affected, only one
T: telepresence can run per machine, and you can't use other VPNs. You may need to add cloud hosts and headless
T: services with --also-proxy. For a full list of method limitations see https://telepresence.io/reference/methods.html
T: Volumes are rooted at $TELEPRESENCE_ROOT. See https://telepresence.io/howto/volumes.html for details.

T: No traffic is being forwarded from the remote Deployment to your local machine. You can use the --expose option to
T: specify which ports you want to forward.

T: Mounting remote volumes failed, they will be unavailable in this session. If you are running on Windows Subystem for
T:  Linux then see https://github.com/datawire/telepresence/issues/115, otherwise please report a bug, attaching
T: telepresence.log to the bug report: https://github.com/datawire/telepresence/issues/new

T: Mount error was: fuse: device not found, try 'modprobe fuse' first
T: Guessing that Services IP range is 10.19.240.0/20. Services started after this point will be inaccessible if are
T: outside this range; restart telepresence if you can't access a new Service.

Looks like there's a bug in our code. Sorry about that!

Here's the traceback:

Traceback (most recent call last):
  File "/usr/bin/telepresence/telepresence/cli.py", line 129, in crash_reporting
    yield
  File "/usr/bin/telepresence/telepresence/main.py", line 78, in main
    runner, remote_info, env, socks_port, ssh, mount_dir
  File "/usr/bin/telepresence/telepresence/outbound/__init__.py", line 60, in launch
    runner_, remote_info, command, args.also_proxy, env, ssh
  File "/usr/bin/telepresence/telepresence/outbound/local.py", line 121, in launch_vpn
    connect_sshuttle(runner, remote_info, also_proxy, ssh)
  File "/usr/bin/telepresence/telepresence/outbound/vpn.py", line 290, in connect_sshuttle
    get_hellotelepresence()
  File "/usr/bin/telepresence/telepresence/outbound/vpn.py", line 274, in get_hellotelepresence
    format(next(counter))
  File "/usr/bin/telepresence/telepresence/runner/__init__.py", line 329, in get_output
    raise CalledProcessError(cpe_exc.returncode, cpe_exc.cmd, output)
subprocess.CalledProcessError: Command '['python3', '-c', "import socket; socket.gethostbyname('hellotelepresence48')"]' returned non-zero exit status 1.

And here are the last few lines of the logfile (see /mnt/c/Users/Jonathan Cardoso/telepresence.log for the complete logs):

  41.4 TEL | [73] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence45'"'"')'
  41.7  73 | Traceback (most recent call last):
  41.7  73 |   File "<string>", line 1, in <module>
  41.7  73 | socket.gaierror: [Errno -2] Name or service not known
  41.7 TEL | [73] exit 1 in 0.30 secs.
  41.8 TEL | [74] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence46'"'"')'
  42.1  74 | Traceback (most recent call last):
  42.1  74 |   File "<string>", line 1, in <module>
  42.1  74 | socket.gaierror: [Errno -2] Name or service not known
  42.1 TEL | [74] exit 1 in 0.31 secs.
  42.2 TEL | [75] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence47'"'"')'
  42.5  75 | Traceback (most recent call last):
  42.5  75 |   File "<string>", line 1, in <module>
  42.5  75 | socket.gaierror: [Errno -2] Name or service not known
  42.5 TEL | [75] exit 1 in 0.32 secs.
  43.6 TEL | [76] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence48'"'"')'
  43.9  76 | Traceback (most recent call last):
  43.9  76 |   File "<string>", line 1, in <module>
  43.9  76 | socket.gaierror: [Errno -2] Name or service not known
  44.0 TEL | [76] exit 1 in 0.30 secs.

btw if there is a need for someone to test a bug fix for that, I'm available to do so.

Disturbing commented 6 years ago

Would love to see this working soon πŸ™πŸΎπŸ™πŸΎπŸ™πŸΎ On Wed, Sep 12, 2018 at 8:00 AM Jonathan Cardoso Machado < notifications@github.com> wrote:

Just tried running it on WSL, got this error:

T: Starting proxy with method 'vpn-tcp', which has the following limitations: All processes are affected, only one T: telepresence can run per machine, and you can't use other VPNs. You may need to add cloud hosts and headless T: services with --also-proxy. For a full list of method limitations see https://telepresence.io/reference/methods.html T: Volumes are rooted at $TELEPRESENCE_ROOT. See https://telepresence.io/howto/volumes.html for details.

T: No traffic is being forwarded from the remote Deployment to your local machine. You can use the --expose option to T: specify which ports you want to forward.

T: Mounting remote volumes failed, they will be unavailable in this session. If you are running on Windows Subystem for T: Linux then see https://github.com/datawire/telepresence/issues/115, otherwise please report a bug, attaching T: telepresence.log to the bug report: https://github.com/datawire/telepresence/issues/new

T: Mount error was: fuse: device not found, try 'modprobe fuse' first T: Guessing that Services IP range is 10.19.240.0/20. Services started after this point will be inaccessible if are T: outside this range; restart telepresence if you can't access a new Service.

Looks like there's a bug in our code. Sorry about that!

Here's the traceback:

Traceback (most recent call last): File "/usr/bin/telepresence/telepresence/cli.py", line 129, in crash_reporting yield File "/usr/bin/telepresence/telepresence/main.py", line 78, in main runner, remote_info, env, socks_port, ssh, mountdir File "/usr/bin/telepresence/telepresence/outbound/init.py", line 60, in launch runner, remote_info, command, args.also_proxy, env, ssh File "/usr/bin/telepresence/telepresence/outbound/local.py", line 121, in launch_vpn connect_sshuttle(runner, remote_info, also_proxy, ssh) File "/usr/bin/telepresence/telepresence/outbound/vpn.py", line 290, in connect_sshuttle get_hellotelepresence() File "/usr/bin/telepresence/telepresence/outbound/vpn.py", line 274, in get_hellotelepresence format(next(counter)) File "/usr/bin/telepresence/telepresence/runner/init.py", line 329, in get_output raise CalledProcessError(cpe_exc.returncode, cpe_exc.cmd, output) subprocess.CalledProcessError: Command '['python3', '-c', "import socket; socket.gethostbyname('hellotelepresence48')"]' returned non-zero exit status 1.

And here are the last few lines of the logfile (see /mnt/c/Users/Jonathan Cardoso/telepresence.log for the complete logs):

41.4 TEL | [73] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence45'"'"')' 41.7 73 | Traceback (most recent call last): 41.7 73 | File "", line 1, in 41.7 73 | socket.gaierror: [Errno -2] Name or service not known 41.7 TEL | [73] exit 1 in 0.30 secs. 41.8 TEL | [74] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence46'"'"')' 42.1 74 | Traceback (most recent call last): 42.1 74 | File "", line 1, in 42.1 74 | socket.gaierror: [Errno -2] Name or service not known 42.1 TEL | [74] exit 1 in 0.31 secs. 42.2 TEL | [75] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence47'"'"')' 42.5 75 | Traceback (most recent call last): 42.5 75 | File "", line 1, in 42.5 75 | socket.gaierror: [Errno -2] Name or service not known 42.5 TEL | [75] exit 1 in 0.32 secs. 43.6 TEL | [76] Capturing: python3 -c 'import socket; socket.gethostbyname('"'"'hellotelepresence48'"'"')' 43.9 76 | Traceback (most recent call last): 43.9 76 | File "", line 1, in 43.9 76 | socket.gaierror: [Errno -2] Name or service not known 44.0 TEL | [76] exit 1 in 0.30 secs.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/telepresenceio/telepresence/issues/115#issuecomment-420680857, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQev5_FxFNDj1451KjjCsMdUmWQ2QAXks5uaSGCgaJpZM4NH3vZ .

-- [image: logo] http://www.kintohub.com Joseph Cooper

Co-founder and CEO

Email: joseph@kintohub.com joseph@kintohub.com

Phone: +852 9131 0727

reegnz commented 5 years ago

I propose evaluating WSL2: https://devblogs.microsoft.com/commandline/announcing-wsl-2/ I guess this problem would be fixed when upgrading to WSL2.

skwasiborski commented 5 years ago

Hi, I did a POC of using vieux/sshfs docker volume driver for mapping volumes when using container method. It seems to work at least when telepresence is run inside a container.

I am not a Python developer and the code is a quick hack but if one of the cotributors would be interested in giving me a hand I would be happy to prepare a proper PR.

ark3 commented 5 years ago

@skwasiborski That's excellent! Can you turn that into a pull request? Then I'll be able to make comments and iterate on it with you. FWIW I won't have time to focus on this until at least next week.

Thank you very much!

skwasiborski commented 5 years ago

I will polish few details over the weekend and make the PR. I will be traveling from mid next week to mid August so I will probably not have time to address your comments before getting back.

skwasiborski commented 5 years ago

@ark any comments to the PR?

weisurya commented 4 years ago

it works on WSL 2