DEV Community

Discussion on: Docker Kubernetes on WSL 2

jeromesnail profile image
Jérôme Meichelbeck


I know this is an old post, but I'm trying anyway...

I tried to make function kubernetes on WSL2 (Ubuntu 20.04 LTS) with docker for desktop and I' just getting crazy because I can't make it work properly.

The kubectl command works like 1 time out of 10 and this is really frustrating. I tried to reinstall Docker completely. I even uninstalled and reinstalled Unbuntu, but I always have the same problem. The kubectl work, then it hangs and I get the famous message: "unable to connect to Kubernetes: an error on the server ("") has prevented the request from succeeding", and then it works again... or not. It seems so random...

I have Docker Desktop 3.3.1 (63152) on Windows 10 20H2, Kubertentes v1.19.7.

I'm going crazy.

Thank for your help !

mikeyglitz profile image
mikeyGlitz Author

Just saw this. Let me see if I can get the same problem and I'll get back to you. In the mean time, I heard there are some issues with WSL and docker because you have to translate NTFS file system to EXT.

mikeyglitz profile image
mikeyGlitz Author

I tried it out on my machine. I know if you're managing multiple Kubernetes clusters, you have to select the one you want to use when you use the kubectl commands with the following options from the Docker for Windows icon on the system tray:

System tray icon > Docker > Kubernetes > Context (select your cluster)

I am noticing issues with the latest version of the Docker client. Doesn't seem to be initializing and there's issues with trying to get the Docker for Windows to restart.

I used to be able to resolve docker issues by running the following commands in Windows terminal

wsl -t docker-desktop
Enter fullscreen mode Exit fullscreen mode