mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
61 lines
1.8 KiB
Plaintext
61 lines
1.8 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
//nodes/nodes/eco-node-maintenance-operator.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="eco-setting-node-maintenance-cr-cli_{context}"]
|
|
= Setting a node to maintenance mode by using the CLI
|
|
|
|
You can put a node into maintenance mode with a `NodeMaintenance` custom resource (CR). When you apply a `NodeMaintenance` CR, all allowed pods are evicted and the node is rendered unschedulable. Evicted pods are queued to be moved to another node in the cluster.
|
|
|
|
.Prerequisites
|
|
|
|
* Install the {product-title} CLI `oc`.
|
|
* Log in to the cluster as a user with `cluster-admin` privileges.
|
|
|
|
.Procedure
|
|
|
|
. Create the following `NodeMaintenance` CR, and save the file as `nodemaintenance-cr.yaml`:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: nodemaintenance.medik8s.io/v1beta1
|
|
kind: NodeMaintenance
|
|
metadata:
|
|
name: nodemaintenance-cr <1>
|
|
spec:
|
|
nodeName: node-1.example.com <2>
|
|
reason: "NIC replacement" <3>
|
|
----
|
|
<1> The name of the node maintenance CR.
|
|
<2> The name of the node to be put into maintenance mode.
|
|
<3> A plain text description of the reason for maintenance.
|
|
+
|
|
. Apply the node maintenance CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f nodemaintenance-cr.yaml
|
|
----
|
|
|
|
.Verification
|
|
|
|
. Check the progress of the maintenance task by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc describe node <node-name>
|
|
----
|
|
+
|
|
where `<node-name>` is the name of your node; for example, `node-1.example.com`
|
|
|
|
. Check the example output:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
Events:
|
|
Type Reason Age From Message
|
|
---- ------ ---- ---- -------
|
|
Normal NodeNotSchedulable 61m kubelet Node node-1.example.com status is now: NodeNotSchedulable
|
|
----
|