2020-09-20 05:22:17 +00:00
|
|
|
if (( $+commands[kubectl] )); then
|
|
|
|
|
__KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
|
|
|
|
|
|
|
|
|
|
if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
|
|
|
|
|
kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
[[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
|
|
|
|
|
|
|
|
|
|
unset __KUBECTL_COMPLETION_FILE
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# This command is used a LOT both below and in daily life
|
|
|
|
|
alias k=kubectl
|
|
|
|
|
|
|
|
|
|
alias kube-get-url="kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print \$NF}'"
|
|
|
|
|
alias kube-get-cert="kubectl get secret \`kubectl get secrets | grep default-token | cut -d \" \" -f1\` -o jsonpath=\"{['data']['ca\.crt']}\" | base64 --decode"
|
|
|
|
|
alias kube-get-token="kubectl get secret \`kubectl get secrets | grep default-token | cut -d \" \" -f1\` -o jsonpath=\"{['data']['token']}\" | base64 --decode"
|
2022-02-19 09:21:09 +00:00
|
|
|
alias kube-context="kubectl config set-context --current"
|