Skip to content

Latest commit

 

History

History
104 lines (68 loc) · 2.73 KB

changing_node_hostname.rst

File metadata and controls

104 lines (68 loc) · 2.73 KB

Changing the hostname of a MetalK8s node

  1. On the node, change the hostname:

    $ hostnamectl set-hostname <New hostname>
    $ systemctl restart systemd-hostnamed
  2. Check that the change is taken into account.

    $ hostnamectl status
    
    Static hostname: <New hostname>
    Pretty hostname: <New hostname>
      Icon name: computer-vm
       Chassis: vm
    Machine ID: 5003025f93c1a84914ea5ae66519c100
       Boot ID: f28d5c64f06c48a3a775e24c4f03d00c
       Virtualization: kvm
    Oerating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
           Kernel: Linux 3.10.0-957.12.2.el7.x86_64
       Architecture: x86-64
  3. On the bootstrap node, check the hostname edition incurred a change of status on the bootstrap. The edited node must be in a NotReady status.

    $ kubectl get <node_name>
    <node_name>    NotReady   etcd,master                   19h       v1.11.7
  4. Change the name of the node in the yaml file used to create it. Refer to installation-expansion-manifest for more information.

    apiVersion: v1 kind: Node metadata: name: <New_node_name> annotations: metalk8s.scality.com/ssh-key-path: /etc/metalk8s/pki/salt-bootstrap metalk8s.scality.com/ssh-host: <node control-plane IP> metalk8s.scality.com/ssh-sudo: 'false' labels: metalk8s.scality.com/version: '' <role labels> spec: taints: <taints>

    Then apply the configuration:

    $ kubectl apply -f <path to edited manifest>
  5. Delete the old node (here <node_name>):

    $ kubectl delete node <node_name>
  6. Open a terminal into the Salt Master container:

    $ kubectl -it exec salt-master-<bootstrap_node_name> -n kube-system -c salt-master bash
  7. Delete the now obsolete Salt Minion key for the changed Node:

    $ salt-key -d <node_name>
  8. Re-run the deployment for the edited Node:

    $ salt-run state.orchestrate metalk8s.orchestrate.deploy_node saltenv=metalk8s- pillar='{"orchestrate": {"node_name": "<new-node-name>"}}'

    Summary for bootstrap_master -------------Succeeded: 11 (changed=9) Failed: 0 -------------Total states run: 11 Total run time: 132.435 s

  9. On the edited node, restart the Kubelet service:

    $ systemctl restart kubelet