Last active
August 17, 2022 02:54
-
-
Save nevermosby/150e51608d2cbfbf4e513f8558616fe5 to your computer and use it in GitHub Desktop.
expose k8s api server provisioned by KIND
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
| ### 1. local port forward on k8s server | |
| # | |
| # :8080 ---> 127.0.0.1:12345(k8s api server local port) | |
| # | |
| sudo socat TCP-LISTEN:8080,reuseaddr,fork tcp:127.0.0.1:12345 | |
| ### 2. local port foward on k8s client host | |
| # | |
| # :8888 ---> 1.2.3.4:8080(the external ip of k8s server) | |
| # | |
| sudo ncat --sh-exec "1.2.3.4 8080" -l 8888 --keep-open | |
| ### 3. change the server into local address in kubeconfig on k8s client host | |
| # | |
| # server: https://127.0.0.1:8888 | |
| # | |
| ### 4. use kubectl with specified kubeconfig and you can access ur KIND | |
| kubectl --kubeconfig ./kind-config get node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment