mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-17 07:14:58 +00:00
Automatic merge from submit-queue Check for EmptyConfig errors when trying to use in-cluster config By removing the default "localhost:8080" behavior several paths in client config began returning err == ErrEmptyConfig rather than err == nil. The code checking for in cluster config was wrong - the logic should be: 1. If loading the underlying config returns a non-empty error, fail 2. If the underlying config is not equal to the default config, return that config (it has user input) 3. If it is possible to use in-cluster config, do so 4. Otherwise return the default config (and or default EmptyConfig error). Fixes #31910 @thockin @lavalamp @deads2k. We introduced EmptyConfig a very long time ago, but until I removed the "localhost:8080" Kubernetes was not actually exposing it (OpenShift relies on it since we don't set an insecure default). This properly falls through to in-cluster config in the described conditions. ```release-note Some components like kube-dns and kube-proxy could fail to load the service account token when started within a pod. Properly handle empty configurations to try loading the service account config. ```