I am attempting to reverse port forward information from a Kubernetes pod 192.168.49.2:30085 to my locoalhost:8000 but I am having issues.
The goal is to get the same response as curl 192.168.49.2:30085
on localhost:8000
One thing I have tried has been using ktunnel with the command ktunnel expose <service_name> 30085:8000
to try to forward this info. Doing this I get the output
INFO[0000] Exposed service's cluster ip is: 10.101.77.99
.INFO[0000] waiting for deployment to be ready
.....
INFO[0001] port forwarding to https://192.168.49.2:8443/api/v1/namespaces/default/pods/thisisatest-59d5584c84-b5qrc/portforward
INFO[0001] Waiting for port forward to finish
INFO[0001] Forwarding from 127.0.0.1:28688 -> 28688
INFO[2022-08-03 20:23:48.605] starting tcp tunnel from source 30085 to target 8000
Which seems normal and I am able to get a response when using curl http://10.101.77.99:30085
on local host 8000 but not the correct response.
I have also attempted to run a tcp server with the command nc 127.0.0.1 8000 | kubectl exec -i <pod_name> tcpserver 127.0.0.1 30085 cat
But am having poor results as well. Am I using these services incorrectly? Or is there a better way to do this all together?