platform9 / ssh-provider

SSH Machine Controller for the Cluster API
11 stars 4 forks source link

Drain node before deleting its corresponding machine, and delete the node object afterward #15

Open dlipovetsky opened 6 years ago

dlipovetsky commented 6 years ago

kubeadm reset does not drain the node. It once did, but this was removed in https://github.com/platform9/pf9-clusteradm/pull/12; some rationale can be seen in the comments to https://github.com/kubernetes/kubernetes/pull/41503.

The provider must

  1. Drain the node before deleting the machine.
  2. Delete the node after deleting the machine.
dlipovetsky commented 6 years ago

The gce and vsphere providers rely on the control plane to clean up Nodes. How this works: The node-controller and node-lifecycle-controller delete Node objects if the cloud provider says their corresponding instances are terminated. This functionality is enabled only when the control plane is running with an integrated cloud provider.

dlipovetsky commented 6 years ago

Drain

There are two options:

  1. kubectl drain
  2. The Eviction API

The Eviction API is consumed as a subresource of individual Pods, which is too low-level. Support for server-side drain may eventually come. For now kubectl drain is the only option.

dlipovetsky commented 6 years ago

The natural place for this functionality is not in the Machine Actuator, but in a MachineDeployment controller, or perhaps the Cluster Actuator.