Last active
January 15, 2019 01:52
-
-
Save yusufnb/3ec24c93c46c0b30bb80681deb022feb to your computer and use it in GitHub Desktop.
Revisions
-
yusufnb revised this gist
Jan 15, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ kc() { toPort=$2 podname=$(kubectl get pods | grep $1 | head -n 1 | awk '{gsub(/ .+/, "", $1); print $1}') echo $podname port=$(kubectl describe pod $podname | grep Port | sed -n 1p | awk '{gsub(/[^0-9]+/,"", $2); print $2}') echo $port -
yusufnb created this gist
Dec 27, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # Usage: kc <pod name> <port> kc() { toPort=$2 podname=$(kubectl get pods | grep $1 | awk '{gsub(/ .+/, "", $1); print $1}') echo $podname port=$(kubectl describe pod $podname | grep Port | sed -n 1p | awk '{gsub(/[^0-9]+/,"", $2); print $2}') echo $port kubectl port-forward $podname $toPort:$port }