This message was deleted.
# rancher-desktop
a
This message was deleted.
r
I am not sure if i understood your issue correctly. The purpose of
Port Forwarding
is to expose the services running in your cluster to your local machine. Can you share some information about the exact steps you are following to help me understand your issue please?
p
Hi, thanks for responding. So I'm connecting to a kakfa service, if I run kubectl port-forward svc/kafka 30092:9092, this works great. So this is port forwarding from my local machine on port 30092 to the cluster's internal kafka service listening on 9092. If I go to the Rancher GUI, and add what I think is the equivalent, it doesn't work.....
r
@powerful-ocean-51915, thanks for providing additional information. Can you please try below simple example and see it works. Just to rule it's not something fundamental related to the Port Forwarding feature on your machine.
Copy code
kubectl create deployment nginx-test --image=nginx --port=80
kubectl create service clusterip nginx-test --tcp=5000:80
.. and then forward the service to the host machine port
30092
from the GUI. You should see the NGINX welcome page when you open
<http://localhost:30092/>
in your browser.
Also, which operating system are you on?
p
Hi
Your example works. I'm connecting from WSL2 running on Windows 11 and I think that's the issue. So I've tried MySQL (which I have running in the cluster), I've enabled rancher port-forwarding from localhost:30306 to 3306 and I can connect from my Spring Boot App and from MySQL workbench using localhost:30306 but not from MySQL client running on WSL2 and I can't connect to Kafka from WSL2 via the port forwarding either but I can from my spring boot app. I think it's pretty clear that Rancher port forwarding is working. Thank you for responding. I don't understand why it's not working from WSL2 but I can look into that. Can you answer one further question on Port Forwarding. Can you persist port-forwarding settings between Rancher reboots?
r
Sure, Please keep us posted what you find out with kafka. And, port-forwarding is not persisted between reboots at present. There's a GitHub issue for this. Please give a thumbs up on the issue, which helps us gauge user's interest for this enhancement and lets us prioritize. Thank you. https://github.com/rancher-sandbox/rancher-desktop/issues/3563
p
I will keep you posted and I have left a comment supporting the port forward persistence on github. Thanks so much for your help :-)
A further question on port forwarding, if we can't, in the short-term, have port-forwarding persistence is there anyway we can run a script to re-set the port forwarding?
1142 Views