Removing a node from a cluster

Use the following command to remove a node:
/root/bin/setup-k8s.sh remove <nodename> [--local-only]
Use the [--local-only] argument if the node you are removing cannot be reached.
  1. Display the nodes in the cluster.
    [root@fss-deployer ~]# kubectl get nodes -owide
    NAME                   STATUS   ROLES                  AGE     VERSION   INTERNAL-IP       EXTERNAL-IP   OS-IMAGE                           KERNEL-VERSION                 CONTAINER-RUNTIME
    fss-computendrplc-01   Ready    control-plane,master   78m     v1.23.1   192.168.102.119   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-02   Ready    control-plane,master   77m     v1.23.1   192.168.102.158   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-03   Ready    control-plane,master   77m     v1.23.1   192.168.102.155   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-04   Ready    <none>                 76m     v1.23.1   192.168.102.124   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-05   Ready    <none>                 27m     v1.23.1   192.168.102.129   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-06   Ready    control-plane,master   7m46s   v1.23.1   192.168.102.195   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
  2. Remove a node from the cluster.
    This example removes node fss-computendrplc-05 from the cluster.
    [root@fss-deployer ~]# /root/bin/setup-k8s.sh remove fss-computendrplc-05 [--local-only]
    fss-computendrplc-05 is not reachable at 192.168.102.124
    SUCCESS: Removed node fss-computendrplc-05
  3. Display the nodes in the cluster
    [root@fss-deployer ~]# kubectl get nodes -owide
    NAME                   STATUS   ROLES                  AGE     VERSION   INTERNAL-IP       EXTERNAL-IP   OS-IMAGE                           KERNEL-VERSION                 CONTAINER-RUNTIME
    fss-computendrplc-01   Ready    control-plane,master   78m     v1.23.1   192.168.102.119   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-02   Ready    control-plane,master   77m     v1.23.1   192.168.102.158   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-03   Ready    control-plane,master   77m     v1.23.1   192.168.102.155   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-04   Ready    <none>                 76m     v1.23.1   192.168.102.124   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
    fss-computendrplc-06   Ready    control-plane,master   7m46s   v1.23.1   192.168.102.195   <none>        Rocky Linux 8.7 (Green Obsidian)   4.18.0-425.13.1.el8_7.x86_64   containerd://1.6.15
You can now replace the failed node with the same type of node (that is, replace a failed master node with another master node or replace a failed worker node with another worker node).