3 ms·
I've just been using this function in my bashrc: kubea(){ if [ "$#" = 1 ]; then KUBECONFIG=~/.kube/configs/"$1" else
by remram 6y ago
I've just been using this function in my bashrc:
kubea(){
if [ "$#" = 1 ]; then
KUBECONFIG=~/.kube/configs/"$1"
else
ls -1 ~/.kube/configs/
fi
}
That way I can "activate" a specific config the same way I activate my Python virtualenv, for a specific terminal. I also add the basename of the config to my prompt.
kubea myproject-PROD
- Nullabillity 6y agoOr, to avoid the persistent state.. function dkube env KUBECONFIG=$HOME/.kube/config-dev $argv end function dkctl dkube kubectl $argv end
- remram 6y agoIt's funny, I used to have something exactly like this, but found that too many other tools and scripts also needed to access the right cluster. Persistent state works better for me in practice.