// Module included in the following assemblies:
//
// * machine-configuration/index.adoc

:_mod-docs-content-type: CONCEPT
[id="machine-config-node-drain_{context}"]
= Understanding the Machine Config Operator node drain behavior

When you use a machine config to change a system feature, such as adding new config files, modifying systemd units or kernel arguments, or updating SSH keys, the Machine Config Operator (MCO) applies those changes and ensures that each node is in the desired configuration state.

After you make the changes, the MCO generates a new rendered machine config. In the majority of cases, when applying the new rendered machine config, the Operator performs the following steps on each affected node until all of the affected nodes have the updated configuration:

. Cordon. The MCO marks the node as not schedulable for additional workloads.
. Drain. The MCO terminates all running workloads on the node, causing the workloads to be rescheduled onto other nodes.
. Apply. The MCO writes the new configuration to the nodes as needed.
. Reboot. The MCO restarts the node.
. Uncordon. The MCO marks the node as schedulable for workloads.

Throughout this process, the MCO maintains the required number of pods based on the `MaxUnavailable` value set in the machine config pool.

[NOTE]
====
There are conditions which can prevent the MCO from draining a node. If the MCO fails to drain a node, the Operator will be unable to reboot the node, preventing any changes made to the node through a machine config. For more information and mitigation steps, see the link:https://github.com/openshift/runbooks/blob/master/alerts/machine-config-operator/MachineConfigControllerDrainError.md[MCCDrainError] runbook.
====

If the MCO drains pods on the master node, note the following conditions:

* In {sno} clusters, the MCO skips the drain operation.

* The MCO does not drain static pods in order to prevent interference with services, such as etcd.

[NOTE]
====
In certain cases the nodes are not drained. For more information, see "About the Machine Config Operator."
====

There are ways to mitigate the disruption caused by drain and reboot cycles by using node disruption policies or disabling control plane reboots. For more information, see "Understanding node restart behaviors after machine config changes" and "Disabling the Machine Config Operator from automatically rebooting."
