Unable to install Kubernetes, stuck on Starting state

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.