Docker for Windows stuck at "Kubernetes is Starting" after updating to version 2.1.1.0 Edge (or Stable)
After hours of trying out different things, here is what finally helped me:
- Restore Docker to Factory Default settings and Quit Docker for Desktop
- Delete the folder
C:\ProgramData\DockerDesktop\pki
(Make a backup of it just in case) - Delete the folder
~\.kube\
(Again make a backup to be safe) - Start Docker again, open Docker settings, make the necessary configuration changes (adding proxy, setting resource limits, etc..), Enable Kubernetes and let it start
- Wait a while and both Docker and Kubernetes will be up now.
When you try to connect to Kubernetes using kubectl, you might face another issue like
Unable to connect to the server: x509: certificate signed by unknown authority
You can solve this by
- Open ~.kube\config in a text editor
- Replace
https://kubernetes.docker.internal:6443
tohttps://localhost:6443
- Try connecting again.
If this still doesn't resolve your issue, go through the logs at C:\ProgramData\DockerDesktop\log\
to debug the issue further
I recommend you to check your etc/hosts file to have following lines.
127.0.0.1 docker-for-desktop
127.0.0.1 kubernetes.docker.internal
Because docker is failing to resolve your localhost and it get stucks on that state.
And Are you behind some corporate proxy? If so try to switch your proxy or try to bypass it the first time you start the K8. I had the same problem and This solved my issue actually not the upgrading or downgrading.
I was facing this today and spent couple of hours trying to fix. First thing is to find out why it keeps hanging in starting. You can find the reason by checking the logs at C:\ProgramData\DockerDesktop. There will be some service.txt files, open the recently modified one.
For me the issue was this,
[19:32:58.189][ApiProxy][Error] time="2020-01-20T19:32:58+13:00" msg="Cannot list nodes: Get https://kubernetes.docker.internal:6443/api/v1/nodes: EOF"
Once the issue is known, then we can easily fix it. I have to removed the folder named pki inside C:\ProgramData\DockerDesktop (as mentioned in issues/4316) and restarted the docker.
Now it's all good. This might not be the reason for all the hangs at starting, but checking the logs will definitely help out.
Hope this helps!