'Docker Desktop Kubernetes Unable to connect to the server: EOF

Earlier today I had increased my Docker desktop resources, but when ever since it restarted Kubernetes has not been able to complete its startup. Whenever I try to run a kubectl command, I get Unable to connect to the server: EOF in response.

I had thought that it started because I hadn't deleting a helm chart before adjusting the resource values in Settings, thus said resources having been assigned to the pods instead of the Kubernetes api server. But I have not been able to fix this issue.

This is what I have tried thus far:

  • Restarting Docker again
  • Reset Kubernetes
  • Reset Docker to factory settings
  • Deleting the VM in hyper-v and restarting Docker
  • Uninstalling and reinstalling Docker Desktop
  • Deleting the pki folder and restart Docker
  • Set the Environment Variable for KUBECONFIG
  • Deleting .kube/config and restart
  • Another clean reinstall of Docker Desktop

But Kubernetes does not complete its startup, so I still get Unable to connect to the server: EOF in response.

Is there anything I haven't tried yet?



Solution 1:[1]

I'll share that what solved this for me was Docker Desktop settings feature for "reset kubernetes cluster". I know that @shenyongo said that a "reset kubernetes" didn't work, and I suppose they mean this.

But for the sake of other readers who may find this, I had this same error message (with Docker Desktop on Windows 11, using wsl2), and the solution for me was indeed to do this:

  1. open the Settings page (in Docker Desktop--right-click on it in the status tray)
  2. then choose "Kubernetes" on the left
  3. then choose "reset kubernetes cluster"

Yes, that warns that "all stacks and kubernetes resources will be deleted", but as nothing else had worked for me (and I wasn't worried about losing much), I tried it, and it did the trick. In moments, all my k8s functionality was back to working.

As background, k8s had been working fine for me for some time. It was just that one day I found I was getting this error. I searched and searched and found lots of folks asking about it but not getting answers, let alone this answer. To be clear, like the OP here I had tried restarting Docker Desktop, restarting the host machine, even downloading and installing an available DD update (I was only a bit behind), and none of those worked. I didn't proceed to ALL the steps shenyongo did, as I thought I'd try this first, and the reset worked.

Hope that may help others. I realize some may fear losing something, but this helps stress the power of declarative vs imperative k8s configuration. It SHOULD be easy to recreate most everything if necessary. I realize it may not be so for everyone.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 charlie arehart