Remove a Kubernetes Node

Remove a Kubernetes Node

This section describes how to remove a Kubernetes Node from your MCP cluster.

To remove a Kubernetes Node:

  1. Log in to the Kubernetes Node that you want to remove.

  2. Stop and disable the salt-minion service on this node:

    systemctl stop salt-minion
    systemctl disable salt-minion
  3. Log in to the Salt Master node.

  4. Verify that the node name is not registered in salt-key. If the node is present, remove it:

    salt-key | grep <node_name><NUM>
    salt-key -d <node_name><NUM>.domain_name
  5. Log in to any Kubernetes Master node.

  6. Mark the Node as unschedulable to prevent new pods from being assigned to it:

    kubectl cordon <node_ID>
    kubectl drain <node_ID>
  7. Remove the Kubernetes Node:

    kubectl delete node cmp<node_ID>

    Wait until the workloads are gracefully deleted and the Kubernetes Node is removed.

  8. Verify that the node is absent in the Kubernetes Nodes list:

    kubectl get nodes
  9. Open your Git project repository with Reclass model on the cluster level.

  10. In infra/config.yml, remove the definition of the Kubernetes Node in question under the reclass:storage:node pillar.

  11. Log in to the Kubernetes Node in question.

  12. Run the following commands:

    systemctl stop kubelet
    systemctl disable kubelet