Add kubectl wrapper for convenience and safety

This commit is contained in:
Daniel Lundin 2020-08-21 09:09:08 +02:00
parent fff0b0016f
commit 1765917dba
No known key found for this signature in database
GPG key ID: 6AB527C9196ACDCC
2 changed files with 10 additions and 0 deletions

9
bin/kubectl-wrapper Executable file
View file

@ -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 "$@"