0

I changed the hostname on one of the nodes and ended up in this when I issue a kubectl get nodes. How can I update this

[root@grs-testkubemaster01 ~]# kubectl get nodes
NAME                                 STATUS     ROLES     AGE       VERSION
abc-testkubemaster01                 Ready      master    22h       v1.10.2
abc-testkubemaster02                 Ready      <none>    19h       v1.10.2
abc-testkubenode01                   Ready      <none>    56m       v1.10.2
abc-testkubenode01.xyz.local         NotReady   <none>    1h        v1.10.2
abc-testkubenode02                   Ready      <none>    19h       v1.10.2
[root@grs-testkubemaster01 ~]#
sbolla
  • 671
  • 3
  • 22
  • 39

2 Answers2

0

As you have list out the nodes

kubectl get nodes 

Now you can select specific node and edit updatable field in the node resources file. for examples

kubectl edit nodes abc-testkubemaster01 
Suresh Vishnoi
  • 17,341
  • 8
  • 47
  • 55
  • abc-testkubenode01.xyz.local and abc-testkubenode01 are the same node. I edited the /etc/hosts on abc-testkubenode01 from abc-testkubenode01.xyz.local to abc-testkubenode01. So I expect to see only one when I do kubectl get nodes, but somehow it shows 2 nodes – sbolla May 02 '18 at 19:40
  • if you could try to edit the host name from above command what result you will get ? It will be interesting if we still get 2 nodes. As I understand its responsibility of kubelet to provide the facts of nodes to the api-server. – Suresh Vishnoi May 02 '18 at 19:56
  • It won't let me edit I get this # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # # nodes "abc-testkubenode01.xyx.local" was not valid: # * []: Forbidden: node updates may only change labels, taints, or capacity (or configSource, if the DynamicKubeletConfig feature gate is enabled) – sbolla May 02 '18 at 20:11
0

Perform the following actions on the master:

kubectl delete node abc-testkubenode01.xyz.local
kubeadm token create --print-join-command

On the worker change your hostname, then reset the kubelet by resetting kubeadm

kubeadm reset 

Then take the output of the join command from the master and paste it into the worker