1

I'm trying to run Kubernetes (Hyperkube) locally using Docker in my machine:

I run this command in order to run the kubelet container:

docker run \
    --volume=/:/rootfs:ro \
    --volume=/sys:/sys:ro \
    --volume=/var/lib/docker/:/var/lib/docker:rw \
    --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
    --volume=/var/run:/var/run:rw \
    --net=host \
    --pid=host \
    --privileged=true \
    --name=kubelet \
    -d \
    gcr.io/google_containers/hyperkube-amd64:${K8S_VERSION} \
    /hyperkube kubelet \
        --containerized \
        --hostname-override="127.0.0.1" \
        --address="0.0.0.0" \
        --api-servers=http://localhost:8080 \
        --config=/etc/kubernetes/manifests \
        --cluster-dns=10.0.0.10 \
        --cluster-domain=cluster.local \
        --allow-privileged=true --v=2

that runs all the other Kubernetes components. But some components (api server, controller manager...) inmediatelly are exited.

controller manager container (exited) logs

I0425 13:47:27.265926       1 plugins.go:71] No cloud provider specified.
I0425 13:47:27.266077       1 replication_controller.go:208] Starting RC Manager
I0425 13:47:27.266208       1 nodecontroller.go:143] Sending events to api server.
E0425 13:47:27.273153       1 nodecontroller.go:229] Error monitoring node status: Get http://127.0.0.1:8080/api/v1/nodes: dial tcp 127.0.0.1:8080: connection refused
E0425 13:55:55.950012       1 controllermanager.go:216] Failed to start service controller: ServiceController should not be run without a cloudprovider.

I have tried to use --cloud-provider="" option in above run command but it still is not working.

Héctor
  • 187
  • 1
  • 4
  • 15

2 Answers2

2

Adding --cloud-provider to that command wont resolve the "failed to start service controller" error message you were seeing.

Technically that command is starting the kubelet - which also has the same flag - but is not the component that is complaining.

In this example, it provides an easy way to start a k8s cluster - somewhat at the expense of configurability. The actual manifests which start the controller-manager (the component that is complaining) are located in /etc/kubernetes/manifests in the hyperkube docker container -- and are not easily overridden.

Now all of that being said, the error you are seeing (Failed to start service controller) should not actually be fatal, and it would just continue past this point (because cloud-provider + service controller are not strictly required). Very likely something else going on here. Would recommend seeing if there are any additional logs past that point, and/or checking the kubelet logs also.

Aaron Levy
  • 121
  • 2
1

Yes I cant see a way to pass that flag. Note that you need to pass the flag to kube-controller-manager here: https://github.com/kubernetes/kubernetes/blob/6c195a4923421f756bf13b2a3b2147c4b242aeed/cluster/images/hyperkube/static-pods/master.json#L16. Passing it to kubelet will have no effect.

I have filed https://github.com/kubernetes/kubernetes/issues/27085 to get this fixed. Please feel free to subscribe to and add more information on that issue.