omrikiei / ktunnel

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

Error sending init tunnel request: rpc error: code = Unavailable desc = connection closed #101

Closed evandro-violet closed 1 year ago

evandro-violet commented 1 year ago

No matter the command or port, I always get connection refused

ktunnel -v expose myapp 8080:8080

INFO[0000] Exposed service's cluster ip is: 10.109.101.60 
.INFO[0000] waiting for deployment to be ready           
.......
INFO[0002] port forwarding to https://kubernetes.docker.internal:6443/api/v1/namespaces/default/pods/myapp-cb4c7d787-wtcdk/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[2023-03-08 11:35:29.679] starting tcp tunnel from source 8080 to target 8080 
E0308 11:35:29.692223   71539 portforward.go:400] an error occurred forwarding 28688 -> 28688: error forwarding port 28688 to pod 5d73125ec061bfee8e37a1804f5a8faab6fdcc2a3516122c4847f302df2eb7e2, uid : exit status 1: 2023/03/08 16:35:29 socat[82760] E connect(16, AF=2 127.0.0.1:28688, 16): Connection refused
ERRO[2023-03-08 11:39:58.898] Error sending init tunnel request: rpc error: code = Unavailable desc = connection closed 

Trying to use ktunnel on mac with kubernetes enabled inside docker.

Wondering if I'm missing some config somewhere?

evandro-violet commented 1 year ago

I realized that using host.docker.internal injects my local machine IP into the pod, this solves my issue without ktunnel.