Skip to content

[enterprise-4.17] OCPBUGS-45262 - Shutting down bare-metal nodes #87915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions modules/powering-off-bare-metal-hosts-web-console.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Module included in the following assemblies:
//
// scalability_and_performance/managing-bare-metal-hosts.adoc

:_mod-docs-content-type: PROCEDURE
[id="powering-off-bare-metal-hosts-web-console_{context}"]
= Powering off bare-metal hosts

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`).
Before you power off a host, you should mark the node as unschedulable and drain all pods and workloads from the node.

.Prerequisites
* You have installed a {op-system} compute machine on bare-metal infrastructure for use in the cluster.
* You have logged in as a user with `cluster-admin` privileges.
* You have configured the host to be managed and have added BMC credentials for the cluster host.
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.

.Procedure
. In the web console, mark the node that you want to power off as unschedulable. Perform the following steps:

.. Navigate to *Nodes* and select the node that you want to power off. Expand the *Actions* menu and select *Mark as unschedulable*.

.. Manually delete or relocate running pods on the node by adjusting the pod deployments or scaling down workloads on the node to zero.
Wait for the drain process to complete.

.. Navigate to *Compute* -> *Bare Metal Hosts*.

.. Expand the *Options menu* for the bare-metal host that you want to power off, and select *Power Off*.
Select *Immediate power off*.

. Alternatively, you can patch the `BareMetalHost` resource for the host that you want to power off by using `oc`.

.. Get the name of the managed bare-metal host.
Run the following command:
+
[source,terminal]
----
$ oc get baremetalhosts -n openshift-machine-api -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.provisioning.state}{"\n"}{end}'
----
+
.Example output
[source,terminal]
----
master-0.example.com managed
master-1.example.com managed
master-2.example.com managed
worker-0.example.com managed
worker-1.example.com managed
worker-2.example.com managed
----

.. Mark the node as unschedulable:
+
[source,terminal]
----
$ oc adm cordon <bare_metal_host> <1>
----
<1> `<bare_metal_host>` is the host that you want to shut down, for example, `worker-2.example.com`.

.. Drain all pods on the node:
+
[source,terminal]
----
$ oc adm drain <bare_metal_host> --force=true
----
+
Pods that are backed by replication controllers are rescheduled to other available nodes in the cluster.

.. Safely power off the bare-metal host.
Run the following command:
+
[source,terminal]
----
$ oc patch <bare_metal_host> --type json -p '[{"op": "replace", "path": "/spec/online", "value": false}]'
----

.. After you power on the host, make the node schedulable for workloads.
Run the following command:
+
[source,terminal]
----
$ oc adm uncordon <bare_metal_host>
----
2 changes: 1 addition & 1 deletion modules/removing-bare-metal-hosts-from-provisioner.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ When you use a `BareMetalHost` object to create a machine in the cluster and lab
[source,terminal]
----
$ oc annotate machineset <machineset> -n openshift-machine-api 'baremetalhost.metal3.io/detached-'
----
----
6 changes: 4 additions & 2 deletions scalability_and_performance/managing-bare-metal-hosts.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
:_mod-docs-content-type: ASSEMBLY
[id="managing-bare-metal-hosts"]
= Managing bare metal hosts
= Managing bare-metal hosts
include::_attributes/common-attributes.adoc[]
:context: managing-bare-metal-hosts

toc::[]

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.
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.

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

* xref:../installing/installing_bare_metal_ipi/ipi-install-expanding-the-cluster.adoc#ipi-install-expanding-the-cluster[Expanding the cluster]
* xref:../machine_management/deploying-machine-health-checks.adoc#machine-health-checks-bare-metal_deploying-machine-health-checks[MachineHealthChecks on bare metal]

include::modules/powering-off-bare-metal-hosts-web-console.adoc[leveloffset=+2]