hyperkube gets stuck while trying to start the API server

2/28/2017

I am running Kubernetes 1.5.0 in hyperkube and it gets stuck with the following lines cyclically repeating in the logs:

E0228 21:28:35.891472   20321 reflector.go:188] pkg/kubelet/config/apiserver.go:44: Failed to list *api.Pod: Get http://localhost:8443/api/v1/pods?fieldSelector=spec.nodeName%3D127.0.0.1&resourceVersion=0: dial tcp 127.0.0.1:8443: getsockopt: connection refused
E0228 21:28:35.892410   20321 reflector.go:188] pkg/kubelet/kubelet.go:386: Failed to list *api.Node: Get http://localhost:8443/api/v1/nodes?fieldSelector=metadata.name%3D127.0.0.1&resourceVersion=0: dial tcp 127.0.0.1:8443: getsockopt: connection refused

Here is how I am starting Hyperkube:

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=kube -d \
    gcr.io/google-containers/hyperkube:v1.5.3 \
    /hyperkube kubelet --containerized \
    --hostname-override="127.0.0.1" \
    --address="0.0.0.0" \
    --api-servers=http://localhost:8443 \
    --allow-privileged=true --v=2
-- steve landiss
docker
google-compute-engine
kubernetes

1 Answer

3/1/2017

To second the comment from @nehal-j-wani, 8443 is the secure port, but you're using the http scheme, without any client or CA certificate.

Sounds like you are not intending to communicate with your local API server over TLS, so you should rather either:

  • use the insecure port (defaults to 8080)
  • fix your kubelet flags to use the TLS communication properly

See also:

-- Antoine Cotten
Source: StackOverflow