I recently updated my Docker for Desktop to latest Edge channel version: 2.1.1.0 on a Windows 10 machine. Unfortunately, after updating, Kubernetes was no longer working as it is always stuck at "Kubernetes is Starting".
I have tried the following so far.
Nothing seems to be working. How can I resolve it?
After hours of trying out different things, here is what finally helped me:
C:\ProgramData\DockerDesktop\pki
(Make a backup of it just in case)~\.kube\
(Again make a backup to be safe)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
https://kubernetes.docker.internal:6443
to https://localhost:6443
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!
What worked for me based on info at https://forums.docker.com/t/waiting-for-kubernetes-to-be-up-and-running/47009: