Search code examples
macoskubernetesdocker-desktop

kubectl giving error: Unable to connect to the server: x509: certificate signed by unknown authority


docker desktop on mac is getting error:

Unable to connect to the server: x509: certificate signed by unknown authority

The following answers didn't helped much:

My system details:

  • Operating system: macOS Big Sur Version 11.6

  • Docker desktop version: v20.10.12

  • Kubernetes version: v1.22.5

When I do:

kubectl get pods

I get the below error:

Unable to connect to the server: x509: certificate signed by unknown authority

Solution

  • Posting the answer from comments


    As appeared after additional questions and answers, there was a previous installation of rancher cluster which left its traces: certificate and context in ~/.kube/config.

    The solution in this case for local development/testing is to delete entirely ~/.kube folder with configs and init the cluster from the scratch.