Created
March 29, 2019 08:09
-
-
Save epcim/33e78f21452a6058d6aeca998a501118 to your computer and use it in GitHub Desktop.
kubernetes k8s kubectl
This file contains 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
# p cmd pritns pods in cluster && | |
# store Kubernetes pod name & namespace to env variable | |
[[ -z $ZSH_NAME ]] || setopt SH_WORD_SPLIT | |
function p() { | |
eval $(kubectl get po --all-namespaces -L app -o wide | tee /dev/stderr|awk '{gsub(/.*-/,"",$8);gsub(/-/,"",$10);printf "%s%s=\x27-n %s %s\x27\n", $10,$8, $1, $2}'|grep -v "^="); | |
} | |
p | |
k logs $fluentbit1 | |
k describe po $fluentd2 | |
## Where to improve | |
# depend on having Label set (app, in this case), but can be easily tweeked to use any other pattern | |
# $8 expect's nodes has name ending xyz-N (where -N is the index number), change to use real pod index number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment