docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 117 forks source link

Kubernetes not starting in Docker desktop #5027

Closed ClimberBear closed 3 years ago

ClimberBear commented 4 years ago

Expected behavior

I have activated Kubernetes marking Enable Kubernetes and Show system container in Kubernetes section of preferences. I expect to have kubernetes up & running

Actual behavior

Kubernetes shows "Starting" and never finish to start The log shows

2020-10-28 17:15:38.186905+0100  localhost com.docker.driver.amd64-linux[707]: cannot get lease for master node: an error on the server ("") has prevented the request from succeeding (get leases.coordination.k8s.io docker-desktop)
2020-10-28 17:15:38.187165+0100  localhost com.docker.backend[673]: external: POST /events 200 "Go-http-client/1.1" ""
2020-10-28 17:15:38.513141+0100  localhost com.docker.driver.amd64-linux[707]: (libsystem_info.dylib) [com.apple.network.libinfo:getaddrinfo] nat64_v4_requires_synthesis(127.0.0.1) == false

repeating forever

Information

I have checked my docker is up to date I have checked localhost in /etc/hosts file is correct Restarting the Mac doesn't solve the problem I have found similar error in https://github.com/docker/for-mac/issues/2985, but, as commented, my hosts file is correct I have found similar error here https://github.com/AliyunContainerService/k8s-for-docker-desktop/issues/56 (reported as solved)

ClimberBear commented 4 years ago

I have found that, maybe, this is a duplicated of 2990. But this appears as solved!

I have workarounded as:

rm -rf ~/Library/Group\ Containers/group.com.docker/pki/
rm -rf ~/.kube

And restarting docker

rjacks161 commented 4 years ago

rm -rf ~/Library/Group\ Containers/group.com.docker/pki/

Fixed my issues!

hiwok commented 3 years ago

Fixed my issues too ! Thanks.

Big Sur 11.0.1 Docker 2.5.0.1

benbendemo commented 3 years ago

I am running the same issue. From the console log, below 3 PIDs periodically generating below error messages.

com.docker.driver.amd64-linux: cannot get lease for master node: an error on the server ("") has prevented the request from succeeding (get leases.coordination.k8s.io docker-desktop)

com.docker.backend: external: POST /events 200 "DockerDesktopGo" ""

com.docker.vpnkit: HTTP proxy --> 108.177.97.82:443 Host:k8s.gcr.io:443 (Origin): Failed to connect to 108.177.97.82:443

OS: macOS Catalina 10.15.7 Docker desktop: 3.0.4(51218) Kubernetes: V1.19.3 Engine: 20.10.2

ghost commented 3 years ago

As an alternative to Docker for Mac's single Kubernetes you can use Docker for Mac to create a multi-node Kubernetes cluster with the Kubernetes feature disabled. Here's a tutorial https://habd.as/post/kubernetes-macos-k3s-k3d-rancher/

benbendemo commented 3 years ago

I have tried a lots of ways to try to let K8S running in my macOS, the below error message occurs all the time.

cannot get lease for master node: an error on the server ("") has prevented the request from succeeding (get leases.coordination.k8s.io docker-desktop)

brian-kalinowski-sonos commented 3 years ago

I was fighting this issue for 2+ days and finally fixed the issue... my /etc/hosts file was corrupted/malformed (probably from some other application).

THE FIX

rs-renato commented 3 years ago

I am running the same issue. From the console log, below 3 PIDs periodically generating below error messages.

com.docker.driver.amd64-linux: cannot get lease for master node: an error on the server ("") has prevented the request from succeeding (get leases.coordination.k8s.io docker-desktop)

com.docker.backend: external: POST /events 200 "DockerDesktopGo" ""

com.docker.vpnkit: HTTP proxy --> 108.177.97.82:443 Host:k8s.gcr.io:443 (Origin): Failed to connect to 108.177.97.82:443

OS: macOS Catalina 10.15.7 Docker desktop: 3.0.4(51218) Kubernetes: V1.19.3 Engine: 20.10.2

Same error here

rs-renato commented 3 years ago

I have tried a lots of ways to try to let K8S running in my macOS, the below error message occurs all the time.

cannot get lease for master node: an error on the server ("") has prevented the request from succeeding (get leases.coordination.k8s.io docker-desktop)

I am not able to do k8s working also. It's sad! I will need to try minikube instead.

Moulick commented 3 years ago

@ClimberBear's solution up above at https://github.com/docker/for-mac/issues/5027#issuecomment-718076014 worked perfectly

Moulick commented 3 years ago

@rs-renato use kind rather than minikube. Kind is like k8s in a container.

benbendemo commented 3 years ago

@ClimberBear's solution up above at #5027 (comment) worked perfectly

Tried many times, can not solve the problem in my docker-for-macos.

Moulick commented 3 years ago

@benbendemo how have you installed Docker ?

benbendemo commented 3 years ago

@benbendemo how have you installed Docker ?

Installed by the dmg file downloaded from docker official website.

timkitch commented 3 years ago

I also had the "cannot get lease for master node: an error on the server" issue and Kubernetes would not start from Docker Desktop. My /etc/hosts file was fine. I tried cleaning the .kube directory and all sorts of things. Finally, I uninstalled Docker Desktop, downloaded and re-installed it, increased the Docker resources and enabled Kubernetes - this worked.

I suspect in my particular case, some remnant of my past experiments with docker, kubernetes, minikube, etc. was interfering. Anyway, if all else fails, try a complete re-install of Docker Desktop.

emnvn commented 3 years ago

I have found that, maybe, this is a duplicated of 2990. But this appears as solved!

I have workarounded as:

rm -rf ~/Library/Group\ Containers/group.com.docker/pki/
rm -rf ~/.kube

And restarting docker

This command fixed my issue (docker version 3.2.0)

rm -rf ~/Library/Group\ Containers/group.com.docker/pki/

alegner commented 3 years ago

Indeed: recreating %windir%\drivers\etc\hosts as a plain 'ASCI text' file and populating it with the following (plus what more I need for other purposes) overcame this (and the next) error:

127.0.0.1 docker-desktop
127.0.0.1 kubernetes.docker.internal
claudioabudio commented 3 years ago

Hello , i am having exactly this same issue , but on a Windows 10 machine, installed docker desktop, and when i try installing Kubernetes, it says "Starting..." and stays there forever :) .

I have also tried resetting docker desktop to factory settings, I have also tried removing the following directory as suggested on some posts: c:\Users\claud\AppData\Local\Docker\pki>

(it seems when docker desktop starts up it recreates that directory again...)

None of these did not work unfortunately.

My docker desktop version is 3.2.1 Kubernetes version is v1.19.7

alegner commented 3 years ago

Only can repeat: ensuring the C:\Windows\system32\drivers\etc\hosts file is plain ascii overcame this problem for me.

Using cygwin 'file' command on it, it did say: UTF-8 Unicode (with BOM) text, with CRLF line terminators (Had done some modifications to this file in the past, still no idea what made it a unicode file). Not sure how to determine this file encoding using Windows' own utilities.

After recreating the file from scratch 'file' now says: ASCII text, with CRLF, LF line terminators ... and all is well.

crablab commented 3 years ago

I am seeing the same issue on macOS 11.2.3 (Big Sur) - none of the above suggestions worked.

Kubernetes: v1.19.7 Docker: v20.10.5

I ended up using the 'Clean / Purge data' option, which did work.

rumimur commented 3 years ago

I did,


1. `rm -r ~/Library/Group\ Containers/group.com.docker/pki/`
2. `rm -r ~/.kube`
3. Navigate to docker icon --> Troubleshoot --> Clean / Purge data. (Thanks @crablab)

The same error shows at the beginning but after waiting for a few minutes you might find the cluster is running.

P.S. Make sure you can reach Google.
instantlinux commented 3 years ago

Is this issue getting priority attention? I'm blocked by it. I have no idea what triggered the problem; most likely an update to docker since the last time I used the local k8s. My version is now 3.2.2 (61853) with kubernetes v1.19.7.

cannot get lease for master node: an error on the server

Tried all the workarounds noted above: no amount of file-removing, updating /etc/hosts or mouse-clicking in the purge / clean / restart sections of the UI will get it to launch any of the k8s containers. The docker ps command reports nothing running. I get the same error each time.

ghost commented 3 years ago

@instantlinux curious, did you try the workaround I suggested on Jan 9?

docker-robott commented 3 years ago

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

jhoughjr commented 3 years ago

Dunno if this should be closed since after the latest update my dev env is broken because docker desktop will not stop start nor reset k8s. Tired reinstalling, deleting the ~/.kube file. Probably should just use bare metal on a pi and not have to worry about forced updates breaking my env while I sleep.

docker-robott commented 3 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked