Docker Community Forums

Share and learn in the Docker community.

Docker for Mac Kubernetes Unauthorized error

I am unable to use the Kubernetes support of Docker for Mac.
Although I am in the right context

$ kubectl config get-contexts
CURRENT   NAME                       CLUSTER                      AUTHINFO             NAMESPACE
*         docker-for-desktop         docker-for-desktop-cluster   docker-for-desktop

when running a command like

kubectl get pods

I get an Unauthorized error:

$ kubectl get pods
error: You must be logged in to the server (Unauthorized)

Hey midiparse, you could try this as follows:

➜  workspace kubectl cluster-info
error: You must be logged in to the server (Unauthorized)
➜  workspace kubectl config use-context docker-for-desktop
Switched to context "docker-for-desktop".
➜  workspace kubectl cluster-info
Kubernetes master is running at https://localhost:6443
KubeDNS is running at https://localhost:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

All in a word, you should run kubectl config at first.