oc command line via jump host

In some environments it can be necessary to use SSH a jump host to access an OpenShift cluster. In this example I will use a SSH socks + http proxy. You need 3 Terminals for this particular solution.

Also refer to This GitHub issue

Terminal 1 - Open the socks connection to the jump host.ssh -D 8888 username@jump.host.domain Leave the terminal open.

Terminal 2 - Install (one-time) and run a http to socks proxy. Install: npm install -g http-proxy-to-socks then run: hpts -s localhost:8888 -p 9999 Leave the terminal open!

Terminal 3 - In the 3rd Terminal, you can now export proxy settings to use the just set-up proxies and then use oc tools as usual. (Maybe you have to have a look at your DNS settings as well, in my scenario this was not the case)

Export proxy settings

export http_proxy=http://localhost:9999  
export https_proxy=http://localhost:9999 

Start using oc

oc login desired.cluster-to.access:8443