Can't run containerized Kubernetes (low-pri)

when I try to start the container manually

Error response from daemon: linux mounts: Path /var/lib/kubelet is mounted on /var but it is not a shared mount.
Error: failed to start containers: kube_kubelet_1

I am using Version 1.11.1-beta12 (build: 7528) and find that I can run hypercube without any errors by simply following the standard command from the k8s Getting Started docs. kubelet and single-node cluster all come up as expected.

My issue is that I only seem to be able to connect to the cluster via kubectl if I am running the command via another docker container. If I point the kubectl installed on my laptop at http://localhost:8080 I get a connection refused error. I think the apiserver container is starting up without exposing 8080, but since that’s run by a script in the kubelet container, it doesn’t seem like I get to control that.

Using the same commands on a docker-machine VM is straightforward, I just have to port forward 8080 to the VM. Can I accomplish something similar with Docker for Mac? I notice the docker run for kubelet has --net=host — is there another setting that would be better?

Any help/ideas here will be much appreciated. I feel like this is really close to just working, but I don’t understand why I can’t reach the k8s server on localhost in the same straightforward way I could with, say, nginx or what have you.

Having googled around a bit more, it appears to me that part of this is by design: the kubenetes github has some discussion here and here about changing the --insecure-bind-address of the API server from 127.0.0.1 and exposing port 8080 in their run command, but it seems to lead to a decision to leave as-is for security and prefer port-forwarding as a workaround. But it is not clear to me how or whether it is possible to port-forward to Docker for Mac’s xhyve hypervisor
?

1 Like

I was able to run kubernetes-anywhere but not using the recommended instructions on containerized Kubernetes on their website.

We’ve released a script that wraps kuberenetes-anywhere launch process under one command. It works properly under Docker for Mac. https://github.com/harbur/ka

1 Like

Thanks for info. That explains why busy box doesn’t come up using that method. Fortunately the weave method by @spiddy works.

I retried running Kubernetes locally using Docker for Mac. Thanks for the hint. When I mount the kubelet volume r/w it works using the latest beta15. This enables to run kubernetes on Docker for Mac without weave which is nice for solo clusters and development.

@jetlabs Could you please share the commands you used to run it!

1 Like