kubectl unable to connect to server: x509: certificate signed by unknown authority kubectl unable to connect to server: x509: certificate signed by unknown authority kubernetes kubernetes

kubectl unable to connect to server: x509: certificate signed by unknown authority


One more solution in case it helps anyone:

My scenario:

  • using Windows 10
  • Kubernetes installed via Docker Desktop ui 2.1.0.1
  • the installer created config file at ~/.kube/config
  • the value in ~/.kube/config for server is https://kubernetes.docker.internal:6443
  • using proxy

Issue: kubectl commands to this endpoint were going through the proxy, I figured it out after running kubectl --insecure-skip-tls-verify cluster-info dump which displayed the proxy html error page.

Fix: just making sure that this URL doesn't go through the proxy, in my case in bash I used export no_proxy=$no_proxy,*.docker.internal


Run:

gcloud container clusters get-credentials standard-cluster-1 --zone us-central1-a --project devops1-218400

here devops1-218400 is my project name. Replace it with your project name.


I got the same error while running $ kubectl get nodes as a root user. I fixed it by exporting kubelet.conf to environment variable.

$ export KUBECONFIG=/etc/kubernetes/kubelet.conf$ kubectl get nodes