<p>Version: kubeadm and kubectl 1.12</p>

<p>I get this error when I change the hostname of one of the Kubernetes slaves. </p>

<p>The error I get from the metric service:</p>

<pre><code>dial tcp: lookup ops-kube-slave-dev-1 on 10.96.0.10:53: no such host
</code></pre>

<p>This IP is not the public or private IP and is completely random.</p>

<p>I add this to the file /etc/hosts:</p>

<pre><code>10.0.1.248 ops-kube-slave-dev-2
10.0.1.154 ops-kube-slave-dev-1
</code></pre>

<p>When I execute <code>$ nslookup ops-kube-slave-dev-2</code>, I get the correct IP.</p>

<p>But still the same error. I want to avoid that for every new node I add to create a new certificate again.</p>

<p>What is the best solution for auto join slave node?</p>

pioupiou
<p>The solution is to provide <code>--hostname-override</code> option to the kubelet configuration (in my case, /etc/systemd/system/kubelet.service.d/10-kubeadm.conf). Let you allow to change the kubernetes nodename without regenerating the certificates.</p>

<p>For more info, see <a href="https://prefetch.net/blog/2017/12/30/getting-your-kubernetes-node-names-right/" rel="nofollow noreferrer">https://prefetch.net/blog/2017/12/30/getting-your-kubernetes-node-names-right/</a>.</p>

<p>PS: On the secondary note,The IP you're talking about is not random, that is the IP of kubedns service of your cluster. You can check it using <code>$ kubectl get svc -n kube-system</code>.</p>

<p>Hope this helps.</p>
