Configure Access to Multiple Cluster using KUBE_CONFIG
Simple way on making access to multiple k8s cluster
Scenario
We have multiple K8s cluster:
A cluster in an on-premise environment (Microk8S)
A cluster on the Cloud environment (AWS)
A cluster on the Cloud environment (Digital Ocean)
You may create multiple config files under the ~/.kube/
directory.
Example:
As you can see on the example above, aws-cluster-01
is the config files for cluster that hosted on AWS, do-k8s-01-kubeconfig
is for the cluster access on the Digital Ocean, while the last one [email protected]
is MicroK8s cluster that reside on the on-premise environment.
Then, you have to modify .bash_profile
or .zshrc
to combine all the access config into one liner KUBE_CONFIG environment variable like the following:
Finally, test the connectivity.
Gist Source: https://gist.github.com/malikperang/82db3f21ac0fde6ab1752ce329f782e5
Last updated