kubeconfig is a configuration file to manage cluster, context, and authentication settings in Kubernetes. 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 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.
Before you start to modify kubeconfig, you should clearly know what your security policies are. Using
kubectl config view, you can check your current settings:
// check current kubeconfig file # kubectl config ...