- Take me to the Video Tutorial
In this section, we will take a look at KubeConfig
.
Client uses the certificate file and key to query the kubernetes Rest API for a list of pods using curl.
-
You can specify the same using kubectl
-
We can move this information to a configuration file called kubeconfig. And then specify this file as the kubeconfig option in the command.
$ kubectl get pods --kubeconfig config
-
The kubeconfig file has 3 sections
- Clusters
- Contexts
- Users
-
To view the current file being used
$ kubectl config view
-
You can specify the kubeconfig file with kubectl config view with "--kubeconfig" flag
$ kubectl config veiw --kubeconfig=my-custom-config
-
How do you update your current context? Or change the current context
$ kubectl config view --kubeconfig=my-custom-config
-
kubectl config help
$ kubectl config -h