Kubernetes: Where is my default Kubeconfig file? - Marc Nuri (2024)

Kubeconfig is the file used by kubectl to retrieve the required configuration to access your Kubernetes cluster.

You can override the default Kubeconfig location by providing kubectl with the --kubeconfig flag or by setting a $KUBECONFIG environment variable.

The default lookup order would be:

  1. --kubeconfig command-line flag. If set, only this file will be considered. n.b. only one instance of this flag is allowed (i.e. only one file can be loaded for a command execution).
  2. $KUBECONFIG environment variable. In this case, a list of files can be provided and kubectl will merge them. A list of paths can be provided, delimited with your filesystem's default path separator.
  3. Default .kube/config file located in the local user's directory. If none of the other options is active, kubectl will only use this file with no merging.

Where is the default Kubeconfig in Linux?

The default location of .kube/config file is:

~/.kube/config

Where is the default Kubeconfig in Windows?

The default location of .kube/config file is:

%USERPROFILE%\.kube\config

Where is the default Kubeconfig in Mac?

Just like in Linux, the default location of .kube/config file is:

~/.kube/config

References

Kubernetes: Where is my default Kubeconfig file? - Marc Nuri (2024)
Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 6275

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.