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

ktunnel expose throws exception: failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session= #88

Open
pietervdheijden opened this issue Sep 1, 2022 · 7 comments · May be fixed by #136

Comments

@pietervdheijden
Copy link

I'm trying to expose a local microservice on port 8080 in my cluster on port 80 via ktunnel:

ktunnel expose app 80:8080 -v

However, this throws the following exception:

INFO[0000] Exposed service's cluster ip is: 10.0.244.123
.INFO[0000] waiting for deployment to be ready
......
INFO[0002] port forwarding to https://controlplane.io:443/api/v1/namespaces/default/pods/app-99b5c8479-f8c55/portforward
INFO[0002] Waiting for port forward to finish
INFO[0002] Forwarding from 127.0.0.1:28688 -> 28688
Forwarding from [::1]:28688 -> 28688
INFO[2022-09-01 14:44:09.131] starting tcp tunnel from source 80 to target 8080
DEBU[2022-09-01 14:44:09.156] attempting to receive from stream
ERRO[2022-09-01 14:44:09.170] failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session=
INFO[2022-09-01 14:44:09.170] new connection port=8080 session=
DEBU[2022-09-01 14:44:09.171] received 0 bytes from server session=00000000-0000-0000-0000-000000000000
DEBU[2022-09-01 14:44:09.171] attempting to receive from stream
INFO[2022-09-01 14:44:09.171] closing listener on 8080 error="context canceled"
DEBU[2022-09-01 14:44:09.171] started reading conn session=00000000-0000-0000-0000-000000000000

ktunnel does work though when exposing on port 8080:

ktunnel expose app 8080:8080 -v

Output:

INFO[0000] Exposed service's cluster ip is: 10.0.232.32
.INFO[0000] waiting for deployment to be ready
....
INFO[0001] port forwarding to https://controlplane.io:443/api/v1/namespaces/default/pods/app-76f85f96f5-x5zf7/portforward
INFO[0001] Waiting for port forward to finish
INFO[0002] Forwarding from 127.0.0.1:28688 -> 28688
Forwarding from [::1]:28688 -> 28688
INFO[2022-09-01 14:46:42.504] starting tcp tunnel from source 8080 to target 8080
DEBU[2022-09-01 14:46:42.531] attempting to receive from stream

My preliminary conclusion is that ktunnel doesn't work on low ports (80, 81, etc.), but does work on high ports (8080, 8081).

I'm using ktunnel version 1.4.8 on WSL2 (Ubuntu 20.04).

@stb1337
Copy link

stb1337 commented Sep 19, 2022

@pietervdheijden i also came to this conclusion #66

@freshteapot
Copy link

I can confirm, I suffered with this exact issue yesterday.

Info

  • On mac
  • Using docker with k3d to run kubernetes
  • Talking to remote server
  • Using port 80, did not work
  • Using port 800, did work

@andrey-bondar
Copy link

The same problem after upgrading to 1.4.8.
I downgraded to 1.4.7 and everything is ok.

@alexef
Copy link

alexef commented Feb 2, 2024

also having this issue

@andrey-bondar
Copy link

@omrikiei Is it possible to fix this issue?

@gms1
Copy link

gms1 commented Jul 14, 2024

got the same issue with version 1.6.1

ERRO[2024-07-14 18:42:17.058] failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session=
INFO[2024-07-14 18:42:17.058] new connection host=localhost port=8092 session=
INFO[2024-07-14 18:42:17.058] closing listener on localhost:8092 error="context canceled"

@gms1
Copy link

gms1 commented Sep 2, 2024

privileged ports do not make much sense in container environments, so there is an open issue for k8s to disable them by default: kubernetes/kubernetes#102612

Until then there are many ways to fix this. A general solution would be to make the container listen on a non-privileged port and to use a service to map it to the privileged port.
The most problematic option would be to run the container as root, another one would be enabling the NET_BIND_SERVICE capability.
( On OpenShift the later could be achieved via service account: https://support.hashicorp.com/hc/en-us/articles/31208737640851-Consul-K8s-on-OpenShift-Service-Mesh-SCC-Requirements)
However, to me it looks like the net.ipv4.ip_unprivileged_port_start setting is the best approach for this project

@gms1 gms1 linked a pull request Sep 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants