Kubernetes 101 : Kubeconfig - the configuration file for the kubernetes cluster - and contexts



Kubeconfig is a kubernetes configuration file that contains information about the cluster, authentication mechanisms, users, contexts, ..., as we could see in the below diagram:


We can let kubernetes know about this configuration file by setting the environment variable "$KUBECONFIG" and exporting it using the below command:


We could Achieve the same by instructing kubernetes to use a specific configuration file, so we could start using a different context and a different configuration using the below command:


To view the setting of our cluster, we use the below command:


We get the below output:


A context is a kubernetes a combination of "cluster/namespace and an account" information.
It is used to move between different kubernetes clusters.

By changing to a different context we "land" in a namespace of a different cluster using the context's user account.

To move to a different cluster, we could use the below command:


The configuration file of the cluster usually lives in the following default location "$HOME/.kube/config".

"$HOME" refers to the home directory of the users. For example the "root" user home directory is "/home/root".

Comments

Leave as a comment:

Archive