diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 41d31c4..e3f6dbb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -79,7 +79,20 @@ fi # Docker and kubernetes aliases command -v k9s > /dev/null 2>&1 if [ $? -eq 0 ]; then - alias kns="k9s" + kns() { + local kube_config + if [ -z $KUBECONFIG ]; then + kube_config=$HOME/.kube/config + else + kube_config=$KUBECONFIG + fi + if [ -f $kube_config ]; then + k9s + else + echo >&2 error: $kube_config does not exist + return 1 + fi + } fi command -v lazydocker > /dev/null 2>&1