Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telepresence fails to start when running on inject-tcp method #1161

Closed
mtp1376 opened this issue Oct 23, 2019 · 6 comments

Comments

@mtp1376
Copy link
Contributor

@mtp1376 mtp1376 commented Oct 23, 2019

What were you trying to do?

I was running telepresence on inject-tcp method(no additional arguments passed other than the --method inject-tcp

What did you expect to happen?

I was expecting to get a shell other than the error below.

What happened instead?

Got the following error:

Automatically included information

Command line: ['/usr/local/bin/telepresence', '--method', 'inject-tcp']
Version: 0.102
Python version: 3.7.4 (default, Jul 9 2019, 18:15:00) [Clang 10.0.0 (clang-1000.11.45.5)]
kubectl version: Client Version: v1.14.1 // Server Version: v1.14.4
oc version: (error: [Errno 2] No such file or directory: 'oc': 'oc')
OS: Darwin Mohammads-MacBook-Pro-4.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,5 Darwin

Traceback (most recent call last):
  File "/usr/local/bin/telepresence/telepresence/cli.py", line 135, in crash_reporting
    yield
  File "/usr/local/bin/telepresence/telepresence/main.py", line 77, in main
    runner, remote_info, env, socks_port, ssh, mount_dir, pod_info
  File "/usr/local/bin/telepresence/telepresence/outbound/setup.py", line 50, in launch
    return launch_inject(runner_, command, socks_port, env)
  File "/usr/local/bin/telepresence/telepresence/outbound/local.py", line 101, in launch_inject
    torsocks_env = set_up_torsocks(runner, socks_port)
  File "/usr/local/bin/telepresence/telepresence/outbound/local.py", line 71, in set_up_torsocks
    raise RuntimeError("SOCKS network proxying failed to start...")
RuntimeError: SOCKS network proxying failed to start...

Logs:

re: twisted.internet.error.DNSLookupError: DNS lookup failed: kubernetes.default.svc.cluster.local.
  96.0  16 | 
  96.0  77 | Traceback (most recent call last):
  96.0  77 |   File "<string>", line 1, in <module>
  96.0  77 | socket.gaierror: [Errno 4] Non-recoverable failure in name resolution
  96.0 TEL | [77] exit 1 in 0.16 secs.
  96.2 TEL | [78] Running: torsocks python3 -c 'import socket; socket.socket().connect(('"'"'kubernetes.default.svc.cluster.local'"'"', 443))'
  96.3  16 | 2019-10-23T06:16:45+0000 [-] Unhandled Error
  96.3  16 | 	Traceback (most recent call last):
  96.3  16 | 	Failure: twisted.internet.error.DNSLookupError: DNS lookup failed: kubernetes.default.svc.cluster.local.
  96.3  16 | 
  96.3  78 | Traceback (most recent call last):
  96.3  78 |   File "<string>", line 1, in <module>
  96.3  78 | socket.gaierror: [Errno 4] Non-recoverable failure in name resolution
  96.3 TEL | [78] exit 1 in 0.16 secs.
  96.3 TEL | END SPAN local.py:42(set_up_torsocks)   15.2s

@ark3

This comment has been minimized.

Copy link
Contributor

@ark3 ark3 commented Oct 24, 2019

Sorry about the crash. Telepresence is trying to connect to kubernetes.default.svc.cluster.local from the Telepresence proxy pod. Most Kubernetes clusters have that Service defined and accessible under that name. Is your cluster configured differently?

@mtp1376

This comment has been minimized.

Copy link
Contributor Author

@mtp1376 mtp1376 commented Oct 24, 2019

root@project-grpc-staging-xx-xxx:/home/Project# curl kubernetes.default.svc.cluster.local
curl: (6) Could not resolve host: kubernetes.default.svc.cluster.local

Seems so.

@ark3

This comment has been minimized.

Copy link
Contributor

@ark3 ark3 commented Oct 24, 2019

How about just kubernetes.default? That's the other obvious option.

$ kubectl run curl-from-cluster -it --rm --image=pstauffer/curl --restart=Never -- curl -svk https://kubernetes.default/api/
*   Trying 10.43.0.1...
* TCP_NODELAY set
* Connected to kubernetes.default (10.43.0.1) port 443 (#0)
* ALPN, offering h2
[...]
@mtp1376

This comment has been minimized.

Copy link
Contributor Author

@mtp1376 mtp1376 commented Oct 24, 2019

It does work with the latter.

$> kubectl run curl-from-cluster -it --rm --image=pstauffer/curl --restart=Never -- curl -svk https://kubernetes.default/api/
*   Trying 10.233.0.1...
* TCP_NODELAY set
* Connected to kubernetes.default (10.233.0.1) port 443 (#0)
@ark3

This comment has been minimized.

Copy link
Contributor

@ark3 ark3 commented Oct 24, 2019

Excellent. As I said in #1141, I'll switch to using just kubernetes.default for this test. Thanks for your help.

@mtp1376

This comment has been minimized.

Copy link
Contributor Author

@mtp1376 mtp1376 commented Oct 24, 2019

@ark3 Thank you for your attention. I am interested in contributing to Telepresence myself. Can you guide me into this so that I can fix this issue myself and give you a PR?

I looked into the project and found this line. Seems if we replace that with test_hostname = "kubernetes.default", it will do the trick. But there is a pending issue about configuring these from the arguments. I will try to look in the project files and find out how you're passing the command line arguments.

mtp1376 added a commit to mtp1376/telepresence that referenced this issue Oct 24, 2019
mtp1376 added a commit to mtp1376/telepresence that referenced this issue Oct 24, 2019
mtp1376 added a commit to mtp1376/telepresence that referenced this issue Oct 24, 2019
mtp1376 added a commit to mtp1376/telepresence that referenced this issue Oct 24, 2019
mtp1376 added a commit to mtp1376/telepresence that referenced this issue Oct 24, 2019
@ark3 ark3 closed this in e4efae2 Oct 25, 2019
ark3 added a commit that referenced this issue Oct 25, 2019
Use kubernetes.default in the inject-tcp connectivity test
Fixes #1141
Fixes #1161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.