The kubeconfig file is the main configuration file that allows access to a Kubernetes cluster.

When you first create your Kubernetes cluster, you are given a generated yaml file.

How to configure the kubeconfig file

The kubectl CLI has the followings preference in which kubeconfig file to use:

  1. by adding the --kubeconfig <file>
  2. by setting a KUBECONFIG environment variable
  3. by using the $HOME/.kube/config file on the local machine