Skip to content

Streaming server stopped unexpectedly: listen tcp x.x.x.x:0: bind: cannot assign requested address

Article Number: 000020350

Environment

Rancher v2.6+
Kubernetes v1.20+

Situation

Adding a new node to an existing cluster stuck in “registering”.
Kubelet pod is in Restarting state on the new node.

$ docker ps -a |grep kubelet
66bd40b36e76 rancher/hyperkube:v1.20.4-rancher1 "/opt/rke-tools/entr…" 7 minutes ago Restarting (255) 32 seconds ago kubelet

The kubelet is failing with below error.

$ docker logs kubelet
"2021-07-26T11:13:48.270162766Z F0726 11:13:48.270086   40730 docker_service.go:415] Streaming server stopped unexpectedly: listen tcp 27.0.0.1:0: bind: cannot assign requested address"

Cause

File /etc/hosts in the new node had below incorrect entry.

27.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

Resolution

Update /etc/hosts file with the correct entry.

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

After updating the file, the kubelet will restart itself and pick up the modified /etc/host file to bind to the loopback IP.