Search code examples
kubernetesdevopskubectlportforwarding

How to forward a k8 pod's port via jumphost


I can ssh into a jumphost from where I can accesss k8 cluster. there is a particular pod which has a UI exposed on port 4040, how can I view that on my local browser ?

What I have figured out so far, by executing the below command

kubectl port-forward podName 4040:4040

I can now access the UI (by text based browser) on jumphost


Solution

  • Had to be done in two steps

    1st run kubectl port-forward podName 4040:4040 from jumpbox

    2nd run ssh -L 4040:localhost:4040 -i some_key.pem user@jumpbox-server from the local machine

    access http://localhost:4040 using browser