hostname doesn't get updated in kubectl get nodes command after hostname change

5/2/2018

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
kubeadm
kubernetes

2 Answers

3/1/2019

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

-- user11136303
Source: StackOverflow

5/2/2018

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
Source: StackOverflow