Remove nodes

1. Drain the node:

kubectl drain <node-name>

This command will gracefully evict all pods from the node.

2. Cordon the node:

kubectl cordon <node-name>

Marks the node as unschedulable, preventing new pods from being scheduled onto it.

3. Verify all pods have been moved:

kubectl get pods --all-namespaces -o wide

Ensure that no pods are running on the node you want to remove.

4. Remove the node from the cluster:

kubectl delete node <node-name>