This is my trick for configuring and switching between multiple kubernetes clusters. We’ll use myCluster
as an example cluster name.
-
Have all of the kubectl acess files (YAML files) added into
~/.kube
, and namedmyCluster.config
. -
Ensure that each of them have a readable and rememberable context name:
-
Ensure that when initializing your console, you reference those files and add them to the
KUBECONFIG
variable. I do this through a local-only file that I source from my dotFiles. Of course, this can be done programatically but you might not want access to clusters to be added dynamically to your console. Up to you. -
Setup a quick alias just to switch between clusters. I have this setup from my dotFiles.
-
Now just load a console and you can do: