diff --git a/.zshrc b/.zshrc index 5cd845d..83d8f92 100644 --- a/.zshrc +++ b/.zshrc @@ -259,6 +259,7 @@ alias ag='ag --pager less' alias cdiff='colordiff -u' alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git' alias hs='history -a; history -n' +alias kubectl='kubectl-wrapper' alias lower="tr '[:upper:]' '[:lower:]'" alias pstree="pstree -Auh | less" alias tail='tail -n $LINES' diff --git a/bin/kubectl-wrapper b/bin/kubectl-wrapper new file mode 100755 index 0000000..7e3a091 --- /dev/null +++ b/bin/kubectl-wrapper @@ -0,0 +1,9 @@ +#!/bin/bash +cfg=.kubeconfig + +path=$(pwd) +while [[ "$path" != "" && ! -e "$path/$cfg" ]]; do + path=${path%/*} +done + +exec env KUBECONFIG="$path/$cfg:$KUBECONFIG:$HOME/.kube/config" kubectl "$@"