Kubernetes fails to start when Docker Desktop starts, requires restart

Hello, I’ve searched and looked through active issues but wasn’t able to find any similar posts.

When I first start Docker Desktop the Kubernetes indicator stays yellow for a long time and finally fails to start, turning red.

Restarting Docker Desktop usually resolves the issue and then k8s runs fine after that.

I can’t seem to find any logs or error messages indicating why. I’m on Windows 11 with WSL2.

Anyone experience this before?

Try to enable showing Kubernetes container images. It is where you enable Kubernetes in Docker Desktop. Then you can investigate witth he docker command like check the logs of the containers. You could also try using the kubectl command on the host. Sometimes some pods can start, but not the whole system so Docker Desktop could give up and show it failed. That doesn’t necessarily mean that Kubernetes has stopped.

Many of us enabled WSL2 integration and install Ubuntu from MS Store after installing Docker Desktop (at least >= 4.7.1) and starting Kubernetes, and found Kubernetes failed to start and stuck, for me the cause was due to the ‘Ubuntu’ in MS Store defaults to Distro 22.04.X which I believe is not working well with Docker Desktop and its Kubernetes engine.

The solution:

run Windows Task Manager to end-task Docker Desktop
uninstall ‘Ubuntu’ which is version 22.04.X in Windows installed apps
run ‘wsl -l -v’ to look at existing status
run ‘wsl -t Ubuntu-22.04’ to terminate Distro ‘Ubuntu-22.04’
run ‘wsl --unregister Ubuntu-22.04’ to unregister it
from MS Store download and install Ubuntu-20.04
run wsl and initialize Ubuntu-20.04
run ‘wsl -s Ubuntu-20.04’ to set default to it
in Docker Desktop Settings/Resources/WSL integration enable it and set it to default WSL distro ‘Ubuntu-20.04’

Kubernetes will start fine and fast.

Thank you for sharing your solution, although I find it unexpected if it indeed solved the Kubernetes failing issue as Kubernetes would run in Docker Desktop’s own WSL distribution. It has nothing to do with other distributions. WSL integration is only for using the client from WSL instead of using it from the host in Powershell. If it solved your problem, then something else must have happaned in addition to the change of the default distribution or their is a bug either in WSL or Docker Desktop and either of it works differently based on what distributions are installed even though Kubernetes does not run in those distributions but in Docker Desktop’s own distribution which you can’t change.