Version: kubeadm and kubectl 1.12
I get this error when I change the hostname of one of the Kubernetes slaves.
The error I get from the metric service:
dial tcp: lookup ops-kube-slave-dev-1 on 10.96.0.10:53: no such host
This IP is not the public or private IP and is completely random.
I add this to the file /etc/hosts:
10.0.1.248 ops-kube-slave-dev-2
10.0.1.154 ops-kube-slave-dev-1
When I execute $ nslookup ops-kube-slave-dev-2
, I get the correct IP.
But still the same error. I want to avoid that for every new node I add to create a new certificate again.
What is the best solution for auto join slave node?
The solution is to provide --hostname-override
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.
For more info, see https://prefetch.net/blog/2017/12/30/getting-your-kubernetes-node-names-right/.
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 $ kubectl get svc -n kube-system
.
Hope this helps.