Tell kubectl to use /etc/hosts for looking up hosts

12/21/2017

When executing into a pod I get following message

Error from server: error dialing backend: dial tcp: lookup k8s-worker-node-a on 192.168.1.1:53: no such host

Is it possible to tell kubectl to use /etc/hosts to lookup machines as I have saved them inside there.

-- elhombre
dns
kubectl
kubernetes

1 Answer

12/21/2017

Can the API server resolve that hostname? It's insufficient for just your workstation to know the hostname, since the API server must be able to contact kubelet on the Node to construct the URL used to view the logs

Turning up the verbosity of kubectl will show the actual handshaking that goes on between your machine, the API server, and the kubelet on the Node, which is how we discovered a similar misconfiguration in our cluster.

-- mdaniel
Source: StackOverflow