Loading Multiple Kubernetes Configs

Since I've started moving towards more Kubernetes cluster operations and management in my day job, I've run into an immediate pain that is managing multiple cluster configs and easily switching from one config to another.

The Kubernetes documentation for managing multiple cluster configs is helpful in that it shows how you can append multiple configs to the $KUBECONFIG environment variable to make them available to the --kubeconfig flag. I didn't want to have to manage all of the configs I have across all environments manually, so a simple snippet (below) in my .zshenv took care of it all for me.

I'm by no means a Bash expert, so any improvements are welcome!

Subscribe to Adam Margherio

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe