Nodes

Nodes

A node is a machine that runs Pods. Cluster-scoped - not in a namespace.

TaskCommand
Listkubectl get nodes -o wide
Detail, conditions, taints, capacitykubectl describe node worker01
Stop scheduling new Podskubectl cordon worker01
Cordon and evictkubectl drain worker01 --ignore-daemonsets --delete-emptydir-data
Allow scheduling againkubectl uncordon worker01
Remove from the clusterkubectl delete node worker01
stateDiagram-v2 [*] --> Ready Ready --> SchedulingDisabled: cordon SchedulingDisabled --> Ready: uncordon SchedulingDisabled --> Drained: drain Drained --> Ready: uncordon

Drain is the maintenance command. What it will not move:

  • DaemonSet Pods - hence --ignore-daemonsets on every drain.
  • Bare Pods - nothing would recreate them, so drain refuses until --force, and then they are gone for good.
  • Pods with emptyDir - the data would be lost, hence --delete-emptydir-data.

Uncordon does not bring Pods back. Rebalancing is a separate decision: kubectl rollout restart deploy/....

Capacity and taints

kubectl describe node worker01 | grep -A6 'Allocated resources'
kubectl describe node control01 | grep -i taint

Allocatable is capacity minus what the kubelet and system reserve. The scheduler works from requests, not from actual usage - a node can be 20 % busy and still refuse Pods.

kubectl delete node only removes the API object; the kubelet keeps running and would re-register. A real removal is drain -> delete node -> kubeadm reset on the machine.

References