Last active
September 11, 2018 10:15
-
-
Save ronald/2cb469ea3fd225217ce8ab2916de7351 to your computer and use it in GitHub Desktop.
sshpod - shell function to access kubernetes pod
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
# add to .bashrc or .bash_profile | |
# usage: | |
# sshpod <podlabel> | |
# sshpod <podlabel> --namespace=<namespace> | |
sshpod() { | |
POD_NAME=$(kubectl get pods --selector "app=$1" -o jsonpath="{.items[0].metadata.name}" $2) | |
kubectl exec -it $POD_NAME /bin/bash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment