Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes not starting in Docker desktop #5027

Closed
2 tasks done
ClimberBear opened this issue Oct 28, 2020 · 26 comments
Closed
2 tasks done

Kubernetes not starting in Docker desktop #5027

ClimberBear opened this issue Oct 28, 2020 · 26 comments

Comments

@ClimberBear
Copy link

ClimberBear commented Oct 28, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 14953D49-8102-48BD-8964-94B55CD0862B/20201028155005

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 #2985, but, as commented, my hosts file is correct
I have found similar error here AliyunContainerService/k8s-for-docker-desktop#56 (reported as solved)

  • macOS Version: macOS Catalina 10.15.7
@ClimberBear
Copy link
Author

ClimberBear commented Oct 28, 2020

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
Copy link

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

Fixed my issues!

@hiwok
Copy link

hiwok commented Dec 2, 2020

Fixed my issues too ! Thanks.

Big Sur 11.0.1
Docker 2.5.0.1

@benbendemo
Copy link

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
Copy link

ghost commented Jan 9, 2021

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
Copy link

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
Copy link

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

  • try running the command file -I /etc/hosts you should see /etc/hosts: text/plain; charset=us-ascii BUT i was getting /etc/hosts: application/octet-stream; charset=binary which was preventing docker/k8s from properly reading it.

  • I edited/reset my hosts file to:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

then reset docker and BOOM up and running no problem!

@rs-renato
Copy link

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
Copy link

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
Copy link

Moulick commented Jan 24, 2021

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

@Moulick
Copy link

Moulick commented Jan 24, 2021

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

@benbendemo
Copy link

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

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

@Moulick
Copy link

Moulick commented Jan 28, 2021

@benbendemo how have you installed Docker ?

@benbendemo
Copy link

@benbendemo how have you installed Docker ?

Installed by the dmg file downloaded from docker official website.

@timkitch
Copy link

timkitch commented Feb 9, 2021

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
Copy link

emnvn commented Mar 4, 2021

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
Copy link

alegner commented Mar 5, 2021

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
Copy link

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
Copy link

alegner commented Mar 10, 2021

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
Copy link

crablab commented Mar 24, 2021

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
Copy link

rumimur commented Mar 25, 2021

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
Copy link

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
Copy link

ghost commented Mar 30, 2021

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

@docker-robott
Copy link
Collaborator

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
Copy link

jhoughjr commented Aug 1, 2021

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
Copy link
Collaborator

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

@docker docker locked and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests