'Docker for Windows stuck at "Kubernetes is Starting" after updating to version 2.1.1.0 Edge (or Stable)
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.
- Restarting Docker
- Resetting the Kubernetes Cluster
- Restoring Factory Default settings
- Restarting machine
- Uninstalling and reinstalling Docker
Nothing seems to be working. How can I resolve it?
Solution 1:[1]
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). Note that many have reported the folder to be located elsewhere:C:\Users\<user_name>\AppData\Local\Docker\pki
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.
Or if you are behind a (corporate) proxy: add kubernetes.docker.internal
to NO_PROXY
(eg export NO_PROXY=kubernetes.docker.internal
), given that the proxy is configured correctly.
If this still doesn't resolve your issue, go through the logs at C:\ProgramData\DockerDesktop\log\
to debug the issue further
Solution 2:[2]
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.
Solution 3:[3]
Irshad's solution worked for me. In my case, pki dir was in
C:\Users\<user_name>\AppData\Local\Docker
Solution 4:[4]
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!
Solution 5:[5]
I faced the problem with Docker Desktop 2.4.0 on Windows 10. The log file was in a different location -
C:\Users<user name>\AppData\Local\Docker\log.txt
Log files always tell the real situation. In my case, I had manually edited the
C:\Users<user name>.kube\config yaml file
and had messed up the spaces and tabs. On correcting it, it started smoothly !
Solution 6:[6]
What worked for me based on info at https://forums.docker.com/t/waiting-for-kubernetes-to-be-up-and-running/47009:
- Reset Docker to factory settings
- Quit Docker
- Set the KUBECONFIG environment variable to %USERPROFILE%\.kube\config
- Restart Docker and enable Kubernetes (still took a few minutes to start)
Solution 7:[7]
For me docker was starting and kubernetes was stuck in Starting
.
Irshad's solution worked for me as well by just removing pki
folder.
Folder location for Windows: C:\Users\<username>\AppData\Local\Docker\pki
.
Solution 8:[8]
My problem was fixed following the next steps:
- Go to
C:\Windows\System32\drivers\etc
- Right click on hosts file and go to Properties
- Disable Read-Only Mode
- Reinstall docker
Solution 9:[9]
If you are looking how at least disable Kubernetes and reset button don't help:
- Click on "Reset Kubernetes Cluster"
- Restart docker (Kubernetes status on the left corner must be red now)
- Clear "Enable Kubernetes" checkbox
- Restart docker again.
Solution 10:[10]
Went through each answer above and this is the only one that fixed it for me!
It contains some of the stuff above, but it is important to clean up all the files, otherwise, it doesn't get fixed
1 uninstall docker 2 Inside of your windows user folder , delete following
.kube
.docker
3 Delete docker and dockerDesktop in ProgramData
C: \ Users \ user\ AppData \ Local C: \ user\ raffaeler \ AppData \ Roaming
4 Installing latest Docker
5 Then only activate Kubernetes, not the other options.
Keep on watching the following log files to known the progress. For me it took lot of time for kubernetes to come up.
%USERPROFILE%\AppData\Local\Docker\log.txt
%USERPROFILE%\AppData\Roaming\Docker\log\vm\kubelet.log
%USERPROFILE%\AppData\Roaming\Docker\log\vm\dockerd.log
Solution 11:[11]
Check the log file at%USERPROFILE%\AppData\Local\Docker\log.txt
In my case I found that kubernetes wouldn't reinstall because I had renamed the directory
%USERPROFILE%\.kube
in order to start from scratch.
However the environment variable KUBECONFIG
was still set, and was referring to a set of concatenated config files which no longer existed.
To fix the issue I deleted the environment variable,
and then reinstalled kubernetes through the docker desktop ui.
This recreated the %USERPROFILE%\.kube\config
I then restored the other config files and recreated the variable KUBECONFIG
with the concatenated values.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow