Skip to content

Commit bc3a26a

Browse files
authored
Merge pull request #87658 from aireilly/OCPBUGS-45262
OCPBUGS-45262 - Shutting down bare-metal nodes
2 parents 82eb701 + 6768598 commit bc3a26a

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Module included in the following assemblies:
2+
//
3+
// scalability_and_performance/managing-bare-metal-hosts.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="powering-off-bare-metal-hosts-web-console_{context}"]
7+
= Powering off bare-metal hosts
8+
9+
You can power off bare-metal cluster hosts in the web console or by applying a patch in the cluster by using the OpenShift CLI (`oc`).
10+
Before you power off a host, you should mark the node as unschedulable and drain all pods and workloads from the node.
11+
12+
.Prerequisites
13+
* You have installed a {op-system} compute machine on bare-metal infrastructure for use in the cluster.
14+
* You have logged in as a user with `cluster-admin` privileges.
15+
* You have configured the host to be managed and have added BMC credentials for the cluster host.
16+
You can add BMC credentials by applying a `Secret` custom resource (CR) in the cluster or by logging in to the web console and configuring the bare-metal host to be managed.
17+
18+
.Procedure
19+
. In the web console, mark the node that you want to power off as unschedulable. Perform the following steps:
20+
21+
.. Navigate to *Nodes* and select the node that you want to power off. Expand the *Actions* menu and select *Mark as unschedulable*.
22+
23+
.. Manually delete or relocate running pods on the node by adjusting the pod deployments or scaling down workloads on the node to zero.
24+
Wait for the drain process to complete.
25+
26+
.. Navigate to *Compute* -> *Bare Metal Hosts*.
27+
28+
.. Expand the *Options menu* for the bare-metal host that you want to power off, and select *Power Off*.
29+
Select *Immediate power off*.
30+
31+
. Alternatively, you can patch the `BareMetalHost` resource for the host that you want to power off by using `oc`.
32+
33+
.. Get the name of the managed bare-metal host.
34+
Run the following command:
35+
+
36+
[source,terminal]
37+
----
38+
$ oc get baremetalhosts -n openshift-machine-api -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.provisioning.state}{"\n"}{end}'
39+
----
40+
+
41+
.Example output
42+
[source,terminal]
43+
----
44+
master-0.example.com managed
45+
master-1.example.com managed
46+
master-2.example.com managed
47+
worker-0.example.com managed
48+
worker-1.example.com managed
49+
worker-2.example.com managed
50+
----
51+
52+
.. Mark the node as unschedulable:
53+
+
54+
[source,terminal]
55+
----
56+
$ oc adm cordon <bare_metal_host> <1>
57+
----
58+
<1> `<bare_metal_host>` is the host that you want to shut down, for example, `worker-2.example.com`.
59+
60+
.. Drain all pods on the node:
61+
+
62+
[source,terminal]
63+
----
64+
$ oc adm drain <bare_metal_host> --force=true
65+
----
66+
+
67+
Pods that are backed by replication controllers are rescheduled to other available nodes in the cluster.
68+
69+
.. Safely power off the bare-metal host.
70+
Run the following command:
71+
+
72+
[source,terminal]
73+
----
74+
$ oc patch <bare_metal_host> --type json -p '[{"op": "replace", "path": "/spec/online", "value": false}]'
75+
----
76+
77+
.. After you power on the host, make the node schedulable for workloads.
78+
Run the following command:
79+
+
80+
[source,terminal]
81+
----
82+
$ oc adm uncordon <bare_metal_host>
83+
----

modules/removing-bare-metal-hosts-from-provisioner.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ When you use a `BareMetalHost` object to create a machine in the cluster and lab
4242
[source,terminal]
4343
----
4444
$ oc annotate machineset <machineset> -n openshift-machine-api 'baremetalhost.metal3.io/detached-'
45-
----
45+
----

scalability_and_performance/managing-bare-metal-hosts.adoc

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
:_mod-docs-content-type: ASSEMBLY
22
[id="managing-bare-metal-hosts"]
3-
= Managing bare metal hosts
3+
= Managing bare-metal hosts
44
include::_attributes/common-attributes.adoc[]
55
:context: managing-bare-metal-hosts
66

77
toc::[]
88

9-
When you install {product-title} on a bare metal cluster, you can provision and manage bare metal nodes using `machine` and `machineset` custom resources (CRs) for bare metal hosts that exist in the cluster.
9+
When you install {product-title} on a bare-metal cluster, you can provision and manage bare-metal nodes by using `machine` and `machineset` custom resources (CRs) for bare-metal hosts that exist in the cluster.
1010

1111
include::modules/about-bare-metal-hosts-and-nodes.adoc[leveloffset=+1]
1212
include::modules/maintaining-bare-metal-hosts.adoc[leveloffset=+1]
@@ -26,3 +26,5 @@ include::modules/removing-bare-metal-hosts-from-provisioner.adoc[leveloffset=+2]
2626

2727
* xref:../installing/installing_bare_metal/ipi/ipi-install-expanding-the-cluster.adoc#ipi-install-expanding-the-cluster[Expanding the cluster]
2828
* xref:../machine_management/deploying-machine-health-checks.adoc#machine-health-checks-bare-metal_deploying-machine-health-checks[MachineHealthChecks on bare metal]
29+
30+
include::modules/powering-off-bare-metal-hosts-web-console.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)