5 ms·
I find the kubectx and kubens tools invaluable for switching contexts and namespaces quickly: https://github.com/ahmetb/kubectx https://github.com/ahmetb/kubect
by kissgyorgy 6y ago
I find the kubectx and kubens tools invaluable for switching contexts and namespaces quickly: https://github.com/ahmetb/kubectx https://github.com/ahmetb/kubectx
- echelon 6y agoThese are amazing! Thanks for sharing.
- neximo64 6y agoI've always been confused with kubectx. How do I actually add a seperate yaml file (say the one I download with my browser from DigitalOcean) into the context?
- kissgyorgy 6y agoYou should read the article: https://knowledgepill.it/posts/kubernetes-kubectl-client-config/#multiple-config-files-and-kubeconfig-variable https://knowledgepill.it/posts/kubernetes-kubectl-client-con...
- remram 6y agoI'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.