0

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?

Rico
  • 58,485
  • 12
  • 111
  • 141
pioupiou
  • 836
  • 2
  • 14
  • 29
  • Why you edit and you put the command line with $ , I want to just copy all the line and just run :S – pioupiou Nov 16 '18 at 07:52

1 Answers1

1

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.

Shudipta Sharma
  • 5,178
  • 3
  • 19
  • 33
Prafull Ladha
  • 12,341
  • 2
  • 37
  • 58
  • Thanks i will tried it, /usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS --hostname-override I change the last line of the config file and i add the --hostname-override but the service don't start – pioupiou Nov 15 '18 at 16:10
  • You need to provide the new hostname of your worker node to it, like --hostname-override= . I hope you are doing it on the worker node which name you want to change – Prafull Ladha Nov 15 '18 at 16:49