// Module included in the following assemblies:
//
// * virt/node_maintenance/virt-setting-node-maintenance.adoc

:_content-type: PROCEDURE
[id="virt-setting-node-maintenance-cli_{context}"]
= Setting a node to maintenance mode in the CLI

Set a node to maintenance mode by marking it as unschedulable and using the `oc adm drain` command to evict or delete pods from the node.

.Procedure

. Mark the node as unschedulable. The node status changes to `NotReady,SchedulingDisabled`.
+
[source,terminal]
----
$ oc adm cordon <node1>
----

. Drain the node in preparation for maintenance. The node live migrates virtual machine instances that have the `LiveMigratable` condition set to `True` and the `spec:evictionStrategy` field set to `LiveMigrate`. All other pods and virtual machines on the node are deleted and recreated on another node.
+
[source,terminal]
----
$ oc adm drain <node1> --delete-emptydir-data --ignore-daemonsets=true --force
----

* The `--delete-emptydir-data` flag removes any virtual machine instances on the node that use `emptyDir` volumes. Data in these volumes is ephemeral and is safe to be deleted after termination.

* The `--ignore-daemonsets=true` flag ensures that daemon sets are ignored and pod eviction can continue successfully.

* The `--force` flag is required to delete pods that are not managed by a replica set or daemon set controller.
