Created
September 19, 2018 19:51
-
-
Save xamox/05e59ba9245d56db0bed2a31d2fbdf83 to your computer and use it in GitHub Desktop.
How to port-foward a kube port-forward
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yo dawg, I heard you like port-fowards so I'm going to port-forward your port-forward. | |
Say you want to test something like maybe run something in minikube locally but connect to something running in the kube cluster. | |
Do your kube port foward | |
kubectl --context k8s-uw1-gcp port-forward prometheus-prometheus-server-7b6f9d99f8-m4vt6 9090 | |
On your host system | |
socat -v TCP-LISTEN:9091,fork TCP:127.0.0.1:9090 | |
Get your ip address on your host system | |
ip addr | |
... | |
# Find the correct one | |
... | |
192.168.1.231 | |
Then in minikube you can now reach the kube server: | |
~ # printf "GET / HTTP/1.0\r\n\r\n" | nc -vvvv 192.168.1.231 9091 | |
192.168.1.231 (192.168.1.231:9092) open | |
HTTP/1.0 302 Found | |
Content-Type: text/html; charset=utf-8 | |
Location: /graph | |
Date: Wed, 23 May 2018 16:34:34 GMT | |
Content-Length: 29 | |
<a href="/graph">Found</a>. | |
sent 18, rcvd 166 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment