Kubectl has this great feature of ‘contexts’ which allow you to switch between clusters or even namespaces within a cluster. But how do you go about adding contexts to your version of kubectl?
I have used the KUBECONFIG environment variable to specify the location of a custom
Now you are empowered by being able to use the kubectl config context functions to switch between clusters without worrying where each of the configuration files are located. I even use a special line in my .bashrc to compile a series of configuration files into one KUBECONFIG environment variable.
If you find kubectl
kubectx
kubens
--namespace
kubectl
.
On MacOSX you can install this tool using brew using the command `brew install kubectx`.
In the end, if you work with multiple Kubernetes clusters I can recommend taking the time to set up a central location for your configuration files, automatically set their paths in the KUBECONFIG environment variable and use kubectx
to quickly switch between them.
HI..
can you please give me the special line which you use in .bashrc to compile a series of configuration files into one KUBECONFIG environment variable