Expiring a Kubernetes node

The following describes a quick and dirty recipe to expire a Kubernetes node (aka take it completely out of service).

Note this assumes you have your kubectl properly setup to point to your Kubernetes cluster.

First drain the node:

  kubectl drain NODENAME

Replace NODENAME with the name of the node to be drained.

Give it some time to complete so your pods have migrated to other nodes.

Then delete the node:

  kubectl delete node NODENAME

And voila you now have expired a Kubernetes node from the cluster.

Posted March 9th, 2018