WindowsmacOSLinux

Where Is the Kubernetes kubeconfig File?

Default ~/.kube/config path on every OS, KUBECONFIG overrides, and context switching basics.

Last updated

kubectl reads cluster credentials from a kubeconfig file defaulting to .kube/config in your home folder on every OS. Cloud CLIs merge new clusters into it on login.

The KUBECONFIG variable overrides the default and can join several files with the OS path separator. Context commands switch clusters without editing files.

Where Kubernetes stores this, by platform

Windows
%USERPROFILE%\.kube\config

Docker Desktop and cloud CLIs write here too. Multiple files join with semicolons under KUBECONFIG.

macOS
~/.kube/config

Same role. Docker Desktop, minikube and kind all merge contexts into this file.

Linux
~/.kube/config

Multiple files join with colons under KUBECONFIG. Keep permissions at 600; tokens inside grant cluster access.

Frequently asked questions

How do I switch Kubernetes clusters?

List contexts, then switch the current one with kubectl context commands. The file updates itself; no hand editing needed.

kubectl says localhost:8080 refused. What happened?

No valid kubeconfig loaded. Check the file exists and KUBECONFIG points somewhere real.

Notice an outdated path? Let us know.