Kubernetes: Use and where to find KubeConfig File

Kubernetes: Use and where to find KubeConfig File

Use of Kubeconfig file:

To access a Kubenetes cluster, we need to be aware about the Kube-API-Server and where it is listening (default 6443) and the user, who have access to that cluster. Passing these information on every command would be a difficult task,

Instead of specifying the details, We can create a config file with all those details, Under the default path, would help to run the command directly, without specifying the “–kubeconfig”

Where to find it:

By default, config file will be available in the use home dir

/<home dir>/.kube/config

This can also be view by the below “kubectl” command

kubectl config view

kubeconfig file, Will be in the same format of an pod definition file (YAML) with the below information:

Cluster details |  Context | User information

Context define, Which user would be used to access which cluster


apiVersion: v1
kind: Config
- cluster:
    server: https://controlplane:6443
  name: kubecluster
- context:
    cluster: kubecluster
    user: kube-admin
  name: kube-admin@kubecluster
current-context: kube-admin@kubecluster
preferences: {}
- name: kube-admin

Start a discussion, If you have any further questions

Similar Posts