K
Q

Docker for Windows stuck at "Kubernetes is Starting" after updating to version 2.1.1.0 Edge (or Stable)

August 29, 2019

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?

-- Irshad P I
windows
docker
kubernetes

15 Answers

August 29, 2019

After hours of trying out different things, here is what finally helped me:

  1. Restore Docker to Factory Default settings and Quit Docker for Desktop

  2. 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

  3. Delete the folder

    ~\.kube\
    (Again make a backup to be safe)

  4. Start Docker again, open Docker settings, make the necessary configuration changes (adding proxy, setting resource limits, etc..), Enable Kubernetes and let it start

  5. 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

  1. Open ~.kube\config in a text editor
  2. Replace
    https://kubernetes.docker.internal:6443
    to
    https://localhost:6443
  3. 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

-- Irshad P I
Source: StackOverflow

January 9, 2020

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.

-- oguz
Source: StackOverflow

February 19, 2021

Irshad's solution worked for me. In my case, pki dir was in <br>C:\Users\<user_name>\AppData\Local\Docker

-- Vikas Verma
Source: StackOverflow

January 20, 2020

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!

-- Jaliya Udagedara
Source: StackOverflow

January 7, 2020

What worked for me based on info at https://forums.docker.com/t/waiting-for-kubernetes-to-be-up-and-running/47009:

  1. Reset Docker to factory settings
  2. Quit Docker
  3. Set the KUBECONFIG environment variable to %USERPROFILE%\.kube\config
  4. Restart Docker and enable Kubernetes (still took a few minutes to start)
-- Mihail Kostira
Source: StackOverflow

April 8, 2021

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
.

-- Sahitya Patel
Source: StackOverflow

October 23, 2020

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 !

-- Mohan
Source: StackOverflow

February 8, 2021

My problem was fixed following the next steps:

  1. Go to
    C:\Windows\System32\drivers\etc
  2. Right click on hosts file and go to Properties
  3. Disable Read-Only Mode
  4. Reinstall docker
-- Pedro Torre de Sousa Sousa
Source: StackOverflow

May 17, 2021

If you are looking how at least disable Kubernetes and reset button don't help:

  1. Click on "Reset Kubernetes Cluster"
  2. Restart docker (Kubernetes status on the left corner must be red now)
  3. Clear "Enable Kubernetes" checkbox
  4. Restart docker again.
-- Roman
Source: StackOverflow

May 11, 2022

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.

-- crowne
Source: StackOverflow

July 31, 2024

After looking at some useful solutions, the solution where you need to resolve the domains correctly was the one I focused on. I didn't need to change the

etc/hosts
file.

I changed settings in the Docker Desktop app

Settings > General > Check "Add the *.docker.internal names to the host's /etc/hosts file" checkbox
This did the trick.

-- Devesh Sawant
Source: StackOverflow

July 30, 2021

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
-- Vladyslav Didenko
Source: StackOverflow

July 19, 2023

For me, the reason of the problem was one more entry in hosts file above the line

127.0.0.1       kubernetes.docker.internal

it was

127.0.0.1       acme.com

this localhost allocation blocks k8s starting

-- MaxDaRo
Source: StackOverflow

January 16, 2024

(latest version)

This thing happens to me whenever I update Docker,

the following has helped me

1)I restarted the Docker engine by Turning the Power button on the Bottom left.

  1. Clean/purge the Wsl, Hyper V, and windows containers and Reseting the K8s Clusters

Hope this works for you

-- Saihari Narayan
Source: StackOverflow

July 26, 2024

I've had this issue a couple of times and updating Docker Desktop to its latest version has worked for me.

-- lbeltran
Source: StackOverflow