Created
July 3, 2024 17:51
-
-
Save 134130/0cfcd22cb02255a6cb7ac8feb9e3b867 to your computer and use it in GitHub Desktop.
run-kubectl-via-ssh-tunnel.sh
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
export LOCAL_PORT=1080 | |
export [email protected] | |
# ssh를 통해 SOCKS5 Proxy를 백그라운드에 실행 | |
ssh -fNq -D "$LOCAL_PORT" "$TARGET" | |
# SOCKS Proxy 정보를 로컬에 구성 | |
export HTTPS_PROXY="socks5://localhost:$LOCAL_PORT" | |
# SOCKS Proxy 구성정보와 함께 kubectl 명령어 실행 | |
kubectl get pods | |
kubectl get ns | |
# 사용완료시, SOCKS5 Proxy 중지 | |
ps aux | grep "ssh -fNq -D $LOCAL_PORT" | grep -v grep | awk '${print $2}' | xargs kill |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment