Skip to content

Instantly share code, notes, and snippets.

@caruccio

caruccio/on.sh

Created Aug 24, 2018
Embed
What would you like to do?
kubectl namespace switcher
# Switch kubernetes namespaces withou touching ~/.kube/config
# Example:
#
# $ on kube-system
# NAME STATUS AGE
# kube-system Active 1y
# $ k get pod
#
on()
{
[ -n "$1" ] || return
kubectl get ns $1 || return
alias k="kubectl -n ${1:-default}"
if echo "$PS1" | \grep -q "^<<[^>]*>>" then
export PS1="${PS1/<<*>> /}"
fi;
export PS1="<<$1>> $PS1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment