Closed gotshub closed 3 years ago
Hello @gtathub, which port is your local machine listening on?
I'm having the same issue.
I have a service listening on port 3000 locally.
If I run ktunnel expose my-service 8000:3000
, then I cannot access it from inside the cluster:
curl: (7) Failed to connect to my-service port 8000: Connection refused
If I then run ktunnel expose my-service 3000:3000
, it works, I can access the service in port 3000 from inside the cluster.
@luislhl @gtathub I'll try to look into it soon. thank you!
Hi @omrikiei,
I tried it with a simple python server running at port 8000.
python3 -m http.server 8000
As @luislhl points out, it works with same the source and target port. With different ports, I need to manually change the service to get it working.
Hi @gtathub, it seems to be working for me
Which version of ktunnel are you using?
Hi @omrikiei,
ah, wait. You were testing the pod and used the port-forward to access port 3000 on the pod, right? I think the ports on the pod are fine. But can you also test the service that was created in Kubernetes by the expose command?
The service should have a different source and target port now (in your case source: 3000 and target: 8000). That means that another pod in the cluster that tries to use this service on port 3000 will be forwarded to your test pod on port 8000 and that leads to the Connection refused
message.
By the way, I'm using ktunnel version 1.3.0
a fix will be available in ~20 minutes
@gtathub @luislhl v1.3.1 with the fix is available through the releases page, and via homebrew. could you kindly confirm the issue is resolved?
That solved the issue! Thank you!
awesome, closing, thank you
I tried to use the expose command to forward traffic from a kubernetes service to a local port:
Access from another pod in the same cluster using curl just says:
It looks like the service will be created with a source port of
80
and a target port of8000
, but the pod is listening on port80
. When I change the service manually and set source and target port to80
, it works.