Docker Community Forums

Share and learn in the Docker community.

Unable to install Kubernetes, stuck on Starting state

Hello there, I am unable to install Kubernetes. Stuck on “Starting…”

I’ve tried the following:

  • Reset docker desktop and quit
  • removed pki folder from C:\users\<user_name>\AppData\Local\Docker
  • removed .kube folder from C:\users\<user_name>
  • Restarted docker desktop, tried installing Kubernetes again
  • Still it’s stuck

I even uninstalled and reinstalled the docker desktop. Nothing is working. Does anyone have a workaround?

Docker Desktop 4.1.1 (69879)
Kubernetes v1.21.5
Windows 10 Pro Version: 10.0.19043

Docker Desktop will not show Kubernetes as “installed” until all of the Kubernetes components are running. To see what is happening with its compontents open a new powershell to have the necessary environment variables set and run:

kubectl get all -n kube-system

Check if the followings are true

1 ) all of the pods have “Running” status.
2 ) deamonset.apps/kube-proxy has “1” in the “Ready” column
3 ) deployment.apps/coredns has “2/2” in the “Ready” column
4 ) replicaset.apps/coredns-HASH has “2” in the “Ready” column

If any of the above statements are not true, use “kubectl describe -n kube-system OBJECTNAME” for more details.

Example:

kubectl describe -n kube-system pod/coredns-558bd4d5db-99qxd

There are some event information at the bottom of the output and you can see the container names in the “Containers” section. In the “kube-system” namespace there is only one container in each pod.

If the pods are running but not ready you can use “kubectl logs -n kube-system PODNAME” to see the containers’ log messages

If you cannot make kubectl work try to enable showing system containers: “Show system containers (advance)” so you can use “docker ps” or the Docker Desktop to see containers in “kube-system” namespace and “docker logs CONTAINERNAME” to see log messages. Of course you will not be able to enable system containers while the Kubernetes is in “installing” state so you would probably have to restart Docker Desktop .

An other issues I had when I tested the installation and you can have when you change configurations and reset the cluster:

When I installed Kubernetes on Docker Desktop, I already had “.kube/config” in my home directory but with an incorrect IP address. Probably because I tried VMWare’s Kubernetes test environment before. I had to delete the .kube folder and, disable Kubernetes on Docker Desktop and Enable again and even “Reset Kubernetes Cluster” to regenerate the config file with the correct parameters. Maybe some of the steps were not necessary but this is how it worked for me.

Also sometimes Docker Desktop cannot see containers even if docker ps can. So I also had to restart Docker Desktop to see the system containers from the Desktop.

Thanks for the prompt response, in order to check what is happening with the Kubernetes components, I think I need to have Kubernetes server installed and running. When I run

kubectl version

I get only the client version and not the server version which means that the server is not installed correctly and I see following

Unable to connect to the server: dial tcp: lookup kubernetes.docker.internal: no such host

So running

kubectl get all -n kube-system

is giving me the same error above ^

Docker desktop is just stuck on Starting state, it never shows me any error so I can troubleshoot further.

After I sent the answer I realised you deleted the config file so you knew exactly what I was writing about :slight_smile:

You need the API server running, yes. But other components like coredns could be in pending status for example.

This is why I included the section starting with the following:

If you tried that already and could not find any Kubernetes related container then it could be a networking issue or…

this means Windows cannot resolve the internal domain which should be set in the hidden C:\Windows\System32\drivers\etc\hosts

You can try to edit it as an Adminisrator and insert this line:

127.0.0.1 kubernetes.docker.internal

I don’t know why would that be missing but it looks like this is the case. It could mean the installation could not even reach the step where those domains are set or the cluster at least partially installed but you cannot use kubectl to see. Again, I recommend enabling system containers.

1 Like

Enabled systems containers, connected to a different network, tried again and it worked.

Clearly didn’t understand what was wrong with the previous network, if there was an error docker desktop is supposed to show.

Thanks Ákos Takács for the help