Managing multiple Kubernetes contexts
Keep all INDIVIDUAL kubeconfig.yaml files under .kube/contexts
1
2
3
.kube/contexts
├── k8scluster1.yaml
└── k8scluster2.yaml
Then put the following line in your .bashrc
(Linux) or .bash_profile
(MacOS)
1
export KUBECONFIG=${HOME}/.kube/config:$(for YAML in $(find ${HOME}/.kube/contexts -name '*.yaml') ; do echo -n ":${YAML}"; done)
This post is licensed under
CC BY 4.0
by the author.