kubeconfig is a configuration file that manages cluster, context, and authentication settings in Kubernetes, on the client side. Using the kubeconfig
file, we are able to set different cluster credentials, users, and namespaces to switch between clusters or contexts within a cluster. It can be configured via the command line using the kubectl config
subcommand or by updating a configuration file directly. In this section, we'll describe how to use kubectl config
to manipulate kubeconfig and how to input a kubeconfig file directly.
If you have gone through the Working with namespace recipe in Chapter 13, Walking through Kubernetes Concepts, where we first mentioned kubeconfig, you will know of its basic concepts. Let's review some key points:
kubeconfig contains three parameters: user, cluster, and context
From the preceding diagram, we can note the following:
- There are three parameters in kubeconfig: User, cluster, and context—user has its own authentication,...