for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

Kubernetes stuck in "starting..." state after 18.02.0-ce-rc1-mac50 upgrade

Open jarlefosen opened this issue 8 years ago • 49 comments

Expected behavior

Docker Engine and Kubernetes should start up within a reasonable time.

Actual behavior

It's been 15 minutes and Kubernetes hasn't yet started up Docker Engine started as expected.

Information

I'm on the Edge release and I just upgraded to 18.02.0-ce-rc1-mac50 when the issue started.

Diagnose output:

Docker for Mac: version: 18.02.0-ce-rc1-mac50 (e1912a8c46ae6f60a85d277f7b8d210dc9670b28)
macOS: version 10.12.6 (build: 16G1114)
logs: /tmp/5F73B1D4-3EBF-408F-95D6-E28BDE7A7CEF/20180130-131929.tar.gz
[OK]     db.git
[OK]     vmnetd
[OK]     dns
[OK]     driver.amd64-linux
[OK]     virtualization VT-X
[OK]     app
[OK]     moby
[OK]     system
[OK]     moby-syslog
[OK]     kubernetes
[OK]     env
[OK]     virtualization kern.hv_support
[OK]     slirp
[OK]     osxfs
[OK]     moby-console
[OK]     logs
[OK]     docker-cli
[OK]     menubar
[OK]     disk

Steps to reproduce the behavior

Not sure if reproducible, but these are the steps I went through.

  1. Early January switch from Stable to Edge releases of Docker to get 17.12 (if I remember correctly)
  2. Enable Kubernetes
  3. ... wait until today
  4. Upgrade Docker to 18.02

jarlefosen avatar Jan 30 '18 12:01 jarlefosen

There's a lot to download. Is your connection good?

akimd avatar Jan 30 '18 16:01 akimd

Yes, the connection here should be well above 200Mbps, so that shouldn't be the issue.

It's still in a starting state.

image

jarlefosen avatar Jan 30 '18 16:01 jarlefosen

yes, actually looking at your logs the problem might be elsewhere. Could you please look at your ~/.kube/config and pay special attention to the context? You should have something like

- context:
    cluster: docker-for-desktop-cluster
    user: docker-for-desktop
  name: docker-for-desktop
current-context: docker-for-desktop

and maybe you have something like this instead as a last line:

current-context: docker-for-desktop-context

Try removing the -context.

akimd avatar Jan 30 '18 16:01 akimd

Current context is something work related, a different provider. Switching to the local instance I see the expected outcome:

$ cat config | grep current-context
current-context: docker-for-desktop

As for the complete docker-for-desktop config itself:

- context:
    cluster: docker-for-desktop-cluster
    user: docker-for-desktop
  name: docker-for-desktop

kubectl isn't able to connect to the instance either so it's not an issue with the indicator in the status bar.

jarlefosen avatar Jan 30 '18 17:01 jarlefosen

But I fear that your Docker is trying to use the wrong context. Your logs have

error: context "docker-for-desktop-context" does not exist

And it's probably in the way of Docker considering that Kube is ok.

What does your Kube item in the Docker menu display?

akimd avatar Jan 30 '18 18:01 akimd

Hi,

Same issue for me with the last update ! The app tells me that something seems wrong with Compose.

Version 18.02.0-ce-rc1-mac50 (22256)

MrMic avatar Jan 30 '18 20:01 MrMic

Most of the time, sadly, the best is to do a factory reset. We currently have an issue with upgrading the Compose integration for Kubernetes.

You can also try to take a look at the kubelet logs : docker run -it --privileged --pid=host justincormack/nsenter1 /bin/sh -c "cat /var/log/kubelet.err.log". You should see kubeadm and kubelet logs.

guillaumerose avatar Jan 31 '18 08:01 guillaumerose

That does NOT solve anything. I have removed completely Docker and reinstall it. Kubernetes still do NOT start! The kubelet.err.log is: --- 8< -------------

I0131 10:04:34.458301    1193 kubelet_node_status.go:83] Attempting to register node docker-for-desktop
E0131 10:04:34.458760    1193 kubelet_node_status.go:107] Unable to register node "docker-for-desktop" with API server: Post https://192.168.65.3:6443/api/v1/nodes: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:35.403894    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://192.168.65.3:6443/api/v1/pods?fieldSelector=spec.nodeName%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:35.403894    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:422: Failed to list *v1.Node: Get https://192.168.65.3:6443/api/v1/nodes?fieldSelector=metadata.name%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:35.404825    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:413: Failed to list *v1.Service: Get https://192.168.65.3:6443/api/v1/services?resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:36.405465    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://192.168.65.3:6443/api/v1/pods?fieldSelector=spec.nodeName%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:36.405721    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:422: Failed to list *v1.Node: Get https://192.168.65.3:6443/api/v1/nodes?fieldSelector=metadata.name%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:36.407611    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:413: Failed to list *v1.Service: Get https://192.168.65.3:6443/api/v1/services?resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:37.406896    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://192.168.65.3:6443/api/v1/pods?fieldSelector=spec.nodeName%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:37.408009    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:422: Failed to list *v1.Node: Get https://192.168.65.3:6443/api/v1/nodes?fieldSelector=metadata.name%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:37.409205    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:413: Failed to list *v1.Service: Get https://192.168.65.3:6443/api/v1/services?resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:37.433355    1193 eviction_manager.go:238] eviction manager: unexpected err: failed to get node info: node 'docker-for-desktop' not found
E0131 10:04:38.408206    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://192.168.65.3:6443/api/v1/pods?fieldSelector=spec.nodeName%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:38.408492    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:422: Failed to list *v1.Node: Get https://192.168.65.3:6443/api/v1/nodes?fieldSelector=metadata.name%3Ddocker-for-desktop&resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused
E0131 10:04:38.409765    1193 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:413: Failed to list *v1.Service: Get https://192.168.65.3:6443/api/v1/services?resourceVersion=0: dial tcp 192.168.65.3:6443: getsockopt: connection refused

---- 8< ------------------------- >8 ---- And now ?? You release something that you even try on a Mac OSX? Seriously, you will have the same issue, you too ...

MrMic avatar Jan 31 '18 10:01 MrMic

I had previously allocated 2GB RAM and 2 CPU cores to the Docker Engine but needed to increase these limits today because a project needed more resources. This of course triggers a restart of Docker Engine and Kubernetes, but now nothing starts up.

For reference here's the logs and it's ID

Docker for Mac: version: 18.02.0-ce-rc1-mac50 (e1912a8c46ae6f60a85d277f7b8d210dc9670b28)
macOS: version 10.12.6 (build: 16G1114)
logs: /tmp/5F73B1D4-3EBF-408F-95D6-E28BDE7A7CEF/20180131-123457.tar.gz
failure: docker ps failed: (Failure "docker ps: timeout after 10.00s")
[OK]     db.git
[OK]     vmnetd
[OK]     dns
[OK]     driver.amd64-linux
[OK]     virtualization VT-X
[OK]     app
[OK]     moby
[OK]     system
[OK]     moby-syslog
[OK]     kubernetes
[OK]     env
[OK]     virtualization kern.hv_support
[OK]     slirp
[OK]     osxfs
[OK]     moby-console
[OK]     logs
[ERROR]  docker-cli
         docker ps failed
[OK]     menubar
[OK]     disk

I was about to do a complete reinstall of Docker when I noticed the issue but found that it didn't actually block my work; so I decided to keep it installed in case it would lead to some bug fixes.

@akimd: The Kube item (context I presume?) Displays all my gke_X environments as well as docker-for-desktop, where the gke_<project> is selected. I've tried swapping back and forth between these environments without any luck.

Now I will proceed to reinstall Docker for Mac, and hopefully the logs I've uploaded can help with discovering the upgrade issues.

@MrMic: Your comment is visually easier to comprehend if you surround the logs with the three ```

jarlefosen avatar Jan 31 '18 11:01 jarlefosen

Aha, I was not aware of the Factory reset button inside the preferences and proceeded to remove the app from Applications/ before installing it again. Not entirely sure how one is supposed to actually uninstall apps from a Mac.

Anyways, once "reinstalled" Edge the naive way I still got the same issues as described above. Currently trying to do a factory reset from within the application, but it doesn't seem to be doing anything.

image

I tried quitting Docker mid-process since it took so long (5+ minutes without any changes) and then starting again. Nothing new happened.

I decided to open up the advanced features and click reset daemon settings in hopes that it would trigger some other resets and hopefully be able to start up again. No luck.

Last option I see is to try and do a Uninstall from within the preferences menu. Clicked it, looks a bit stuck as well. Could it be because Docker and Kubernetes aren't starting properly, or at least Docker Engine? I chose a bold move and force quit the hyperkit process while the uninstall window was open, since it looked like it was stuck. That gave me a message almost immediately stating the uninstall was successful. Well, that was unexpected.

Now what? Well, let's install Docker Edge once again and see how it looks.

image

It asked for privileges, and asks me to log in with my Docker ID. That feels just about right! And look at that, Docker Engine is running! 🐳

image

Diagnose looks good. But it did initially as well when there were Kube issues. Let's check that commands are working properly. Still looking good.

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

image

Kubernetes also works!

How I was able to re-install Docker

Go to Docker preferences, click Reset -> Uninstall. While the bar is stuck, open Activity Monitor and force quit hyperkit.

I wrote this as I went along, luckily it ended with a fixed issue. Not sure what went wrong along the way, but this is how I fixed my issue at least.

jarlefosen avatar Jan 31 '18 12:01 jarlefosen

I follow what @jarlefosen has written and finally, all is up: Docker + Kubernetes. Thank you! I need now to reinstall all my containers now ...

Rgds,

MrMic avatar Jan 31 '18 17:01 MrMic

Hi guys,

It does appear that something was wrong in the way we did the diverse "Resets", and it could spin endlessly. The next Edge will do much better in this area.

I'm happy you managed to solve your issue. To bad though we could be pinpointed what it was.

akimd avatar Feb 01 '18 14:02 akimd

Thank you for following up on this issue @akimd 👏

Feel free to close this issue, but I think it's fine to have it open and visible until the next Edge release in case more people are affected by this and want to continue the conversation.

jarlefosen avatar Feb 02 '18 11:02 jarlefosen

I concur too.

MrMic avatar Feb 02 '18 12:02 MrMic

rc2 has just been released!

akimd avatar Feb 02 '18 15:02 akimd

Just upgraded it to RC2. Great to find Kubernetes v1.9.2 up and running flawlessly.

On 02-Feb-2018 9:43 PM, "Akim Demaille" [email protected] wrote:

rc2 has just been released!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/docker/for-mac/issues/2536#issuecomment-362623308, or mute the thread https://github.com/notifications/unsubscribe-auth/AATIiHAZYmmY1ShtTbtermM5NzNeP6Wrks5tQy6cgaJpZM4RyQEV .

ajeetraina avatar Feb 02 '18 16:02 ajeetraina

Due to China's network environment, in this case, we can refer to this solution: https://github.com/maguowei/k8s-docker-for-mac

Danceiny avatar Apr 13 '18 09:04 Danceiny

it still doesn‘t work in step 4. @Danceiny

check the err log in the way: docker run -it --privileged --pid=host justincormack/nsenter1 /bin/sh -c "cat /var/log/kubelet.err.log"

I have error message as below:

E0430 13:25:24.853253 2025 kubelet_node_status.go:106] Unable to register node "docker-for-desktop" with API server: Post https://192.168.65.3:6443/api/v1/nodes: dial tcp 192.168.65.3:6443: getsockopt: connection refused

shidongwa avatar Apr 30 '18 13:04 shidongwa

Emmmm, I think the best way should be configuring the docker proxies, I set manual proxy configuraiton, both http and https, point to 127.0.0.1:1080 (on this endpoint I opened http proxy by ssr). Actually I used both two ways(k8s-docker-for-mac and proxy) and finally I succeeded. @shidongwa

Danceiny avatar May 03 '18 08:05 Danceiny

thanks @Danceiny , it works for me using solution of minikube, ssr, privoxy and hyberkit. I document the steps at http://shidonghua.work/2018/05/01/mac-minikube-install/

shidongwa avatar May 19 '18 12:05 shidongwa