omrikiei / ktunnel

A cli that exposes your local resources to kubernetes
GNU General Public License v3.0
958 stars 75 forks source link

failed parsing session uuid from stream, skipping error="invalid UUID length: 0" during inject deployment #66

Closed stb1337 closed 2 years ago

stb1337 commented 3 years ago

I have a K8s Deployment which declares containerPort 80 for an REST Server.

I want to redirect all ingress traffic from this K8s Deployment (POD) to my local machine.

I am using version 1.4.0

ktunnel inject deployment -n cluster-base rest-callback-handler 80 -v
INFO[0000] Injecting tunnel sidecar to cluster-base/rest-callback-handler 
INFO[0000] ProgressDeadlineInSeconds is currently 600s. It may take this long to detect a deployment failure. 
INFO[0000] Waiting for deployment to be ready           
INFO[0002] deployment "rest-callback-handler" successfully rolled out 
INFO[0002] port forwarding to https://api.......com/api/v1/namespaces/cluster-base/pods/rest-callback-handler-84c97c9689-npkzn/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[2021-09-08 09:54:12.389] starting tcp tunnel from source 80 to target 80 
DEBU[2021-09-08 09:54:12.482] attempting to receive from stream            
ERRO[2021-09-08 09:54:12.527] failed parsing session uuid from stream, skipping  error="invalid UUID length: 0" session=
INFO[2021-09-08 09:54:12.527] new connection                                port=80 session=
ERRO[2021-09-08 09:54:12.527] failed connecting to localhost on port 80 scheme tcp  error="dial tcp [::1]:80: connect: connection refused"
ERRO[2021-09-08 09:54:12.527] failed sending close message to tunnel stream  error=EOF
DEBU[2021-09-08 09:54:12.527] attempting to receive from stream            
INFO[2021-09-08 09:54:12.527] closing listener on 80                        error="context canceled"
omrikiei commented 3 years ago

Hi @sTb1337, according to this line failed connecting to localhost on port 80 scheme tcp error="dial tcp [::1]:80: connect: connection refused" it seems like your local machine is not listening on port 80... are you listening on a different port locally?

omrikiei commented 3 years ago

Hi @sTb1337 is this still an issue?

stb1337 commented 2 years ago

i am so sry for answering you so late. I will have a look. Thank you for your patience.

omrikiei commented 2 years ago

@sTb1337 hi, this issue seems stale, is it still relevant?

stb1337 commented 2 years ago

@omrikiei sry for keeping you wanting so long.

Yes the problem still exists with version 1.4.8 and I am running an http server on my local port 80.

ktunnel inject deployment broker 80:80 -n cluster-base-integration INFO[0000] Injecting tunnel sidecar to cluster-base-integration/broker INFO[0000] ProgressDeadlineInSeconds is currently 600s. It may take this long to detect a deployment failure. INFO[0000] Waiting for deployment to be ready INFO[0001] deployment "broker" successfully rolled out INFO[0001] port forwarding to https://api.....com/api/v1/namespaces/cluster-base-integration/pods/broker-86554d5467-zbrd6/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-16 10:55:58.443] starting tcp tunnel from source 80 to target 80 ERRO[2022-09-16 10:55:58.666] failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session= INFO[2022-09-16 10:55:58.666] new connection port=80 session= INFO[2022-09-16 10:55:58.667] closing listener on 80 error="context canceled"

Also with only exposing a k8s service is failing: ktunnel expose -n cluster-base-integration broker 80:80 INFO[0000] Exposed service's cluster ip is: 100.108.39.241 .INFO[0000] waiting for deployment to be ready .. INFO[0001] port forwarding to https://api.....com/api/v1/namespaces/cluster-base-integration/pods/broker-64c5c64444-87wn9/portforward INFO[0001] Waiting for port forward to finish INFO[0001] Forwarding from 127.0.0.1:28688 -> 28688 Forwarding from [::1]:28688 -> 28688 INFO[2022-09-16 10:49:08.801] starting tcp tunnel from source 80 to target 80 ERRO[2022-09-16 10:49:08.977] failed parsing session uuid from stream, skipping error="invalid UUID length: 0" session= INFO[2022-09-16 10:49:08.978] new connection port=80 session= INFO[2022-09-16 10:49:08.978] closing listener on 80 error="context canceled"

Error within the started ktunnel pod:

INFO[2022-09-16 09:04:39.237] Starting to listen on port 28688 INFO[2022-09-16 09:04:39.679] opening connection port=80 schema=TCP ERRO[2022-09-16 09:04:39.679] Failed listening on port 80 error="listen tcp :80: bind: permission denied"

stb1337 commented 2 years ago

I was able to resolve this problem by NOT using port 80 to be exposed within the cluster.

ktunnel expose broker 8080:80 -n cluster-base-integration INFO[0000] Exposed service's cluster ip is: 100.111.230.107 .INFO[0000] waiting for deployment to be ready .... INFO[0001] port forwarding to https://api.....com/api/v1/namespaces/cluster-base-integration/pods/broker-67554bf68d-f2zxw/portforward INFO[0001] Waiting for port forward to finish INFO[0001] Forwarding from 127.0.0.1:28688 -> 28688 Forwarding from [::1]:28688 -> 28688 INFO[2022-09-16 11:07:50.846] starting tcp tunnel from source 8080 to target 80 INFO[2022-09-16 11:08:23.488] new connection port=80 session=f9699c99-7a73-4a15-9aec-755f29239cfe i have changed my k8s ingress from 80 to 8080. Now its working.