ktunnel
ktunnel copied to clipboard
ktunnel expose throws exception: failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session=
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).
@pietervdheijden i also came to this conclusion https://github.com/omrikiei/ktunnel/issues/66
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
The same problem after upgrading to 1.4.8. I downgraded to 1.4.7 and everything is ok.
also having this issue
@omrikiei Is it possible to fix this issue?
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"
privileged ports do not make much sense in container environments, so there is an open issue for k8s to disable them by default: https://github.com/kubernetes/kubernetes/issues/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