I had a kubernetes single node cluster on my windows 10 machine. Due some errors I had to reinstall the Docker Desktop
and since then kubernetes installation has failed while docker installed successfully. All attempts to resolve e.g. deleting the config
file in .kube
directory and complete reinstallation have failed. See attached pix for details. Installed docker version is Docker version 18.09.2, build 6247962
. All search online efforts do not yield a possible solution. I would appreciate pointers to a solution or walk-around.
I stucked in two kinds of error
- system pods running, found labels but still waiting for labels...
- xxxx: EOF
I finally sovled it by following the advice by the following project, https://github.com/AliyunContainerService/k8s-for-docker-desktop/ Do as it told you, if not work, remove ~/.kube and ~/Library/Group\ Containers/group.com.docker/pki directory, then restart docker desktop and wait like 5 minutes. The Kubernetes status is running eventually.
For those who did not find the pki folder in the C:/ProgramData/DockerDesktop
, you may find it in this location :
C:\Users\<your_user_name>\AppData\Local\Docker
Delete it and see if it works. Also make sure to delete the .kube folder
deleting the pki directory in C:\programdata\DockerDesktop solved the issue for me.
I would suggest you to check running Kubernetes components using command: docker ps -a --filter name=k8s
as recommended by Nepomucen here.
Then, check the logs for each component using command:docker logs {container id from the previous command}
. You might some idea from the logs.
In my case, it was- x509: certificate is valid for docker-for-desktop, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, host.docker.internal,
not vm.docker.internal
So, I tried the solution suggested in this link and it worked for me
C:\ProgramData\DockerDesktop\pki
and restarting Docker fixed it. –
Borden For anyone coming to this question, what worked for me was the following:
- Stop Docker
- Add
kubernetes.docker.internal
to Windows environment variables list under the nameNO PROXY
(**) - Reset docker to default settings
- Close and reopen it
- Enable Kubernetes
*I followed the steps from this issue on github: https://github.com/docker/for-win/issues/6627#issuecomment-637713206. You can find more explanations there, but mainly windows needs to let kubernetes 'bypass' its proxy.
Some clients support the no_proxy environment variable that specifies a set of domains for which the proxy should not be consulted
**To add a windows environment variable, type environment
on windows search and open 'Edit the system environment variables' or open it directly from Control Panel. Click environment variables
button and add a new one to the system variables
Simply doing the "Reset Kubernetes cluster" on the Reset tab resolved the issue for me.
For future reference, one workaround solution to this MAY BE to delete the C:/ProgramData/DockerDesktop/pki folder.
In my case, I had my kubectl context set to AWS EKS.
- Once I have reset my current kubectl context to docker
kubectl config use-context docker-desktop
- Restarted the Docker Desktop
- Reset Kubernetes cluster using the button, it started - all supergreen
I would start from analyzing logs of Kubernetes system-containers.
On how to do this please refer to this answer on StackOverflow.
kube-dns
image is not running here is the output :docker ps -a --filter name=k8s_kubedns_kube-dns --format "table {{.ID}}\t{{.Image}}" CONTAINER ID IMAGE
. –
Staphylorrhaphy In my case the system containers were not created, and all I was getting in log was EOF returned from the kubernetes, at the point when the system containers were supposed to be created.
After investigation, there were solutions with .kube and config deletion, pki and similar. I also investigated whether the network setup and company policies, dns and similar would have an impact. All was partially posible but none provided solution.
The only solution that worked was to Uninstall and Install the latest stable Docker Desktop. So, my understanding is that since there are a lot of upgrades on this docker setup over time, some config or part of installation made a confusion and unrecovarable kubernetes setup/first start.
I had the same problem..
I had deleted the .kube folder located in the user's home directory
(C:\Users\mani\.kube)
Fixed the problem for me...
Ok finally I found the problem in my kube.
Its seems that my host file was not valid ,cant reproduce is but you can fallow the steps:
open command line and try to get a ping to kubernetes.docker.internal, this is k8s ip that docker adds to the host file.
if you cant get ping (127.0.0.1), save copy of host file (c:\windows\system32\drivers\etc\host) and try to edit/remove docker comments "# Added by Docker Desktop" etc.
if you get the ping docker can get the configured ip.
note: in .kube\config you can see the IP under "server: " key.
- you can see the server starting to work in the DDfW image tab (you will see images pops and the total size change. if no working try to restart docker to default factory setting reinstall etc.
In my case, I had to completely uninstall and reinstall the Windows Subsystem for Linux.
So:
- Uninstall Docker Desktop. (I also deleted/renamed all the config-data folders)
- Uninstall WSL. (final step being the unchecking of "Windows Subsystem for Linux" entry in "Turn Windows features on and off")
- Restart PC.
- Reinstall WSL. (including another restart)
- Reinstall Docker Desktop.
I maybe didn't need every step, but the reinstalling of WSL, at least, was needed in my case. (I did the full Docker Desktop reinstall, and that wasn't enough)
In my case I couldn't ping the Kubernetes, so:
- try
ping kubernetes.docker.internal
in the Command Line - If you cant get a ping, seems like you have the same problem.
- To fix it, open the hosts file (
c:\windows\system32\drivers\etc\hosts
) and add a line:
127.0.0.1 kubernetes.docker.internal
to the end of the file. - Now it should work)
In my case the problem was with the ~/.kube/config
that I had manually edited to add more k8s contexts.
Run this command to validate your config file:
kubectl config view
$ kubectl config view
error: error loading config file "~\.kube\config": yaml: line 88: found a tab character that violates indentation
Fix any errors you see and try again.
I've got a message Unable to connect to the server: dial tcp: lookup kubernetes.docker.internal: no such host
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
Link: https://forums.docker.com/t/unable-to-install-kubernetes-stuck-on-starting-state/117048
© 2022 - 2024 — McMap. All rights reserved.