diff --git a/modules/powering-off-bare-metal-hosts-web-console.adoc b/modules/powering-off-bare-metal-hosts-web-console.adoc new file mode 100644 index 000000000000..cdc757ae7540 --- /dev/null +++ b/modules/powering-off-bare-metal-hosts-web-console.adoc @@ -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 <1> +---- +<1> `` 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 --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 --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 +---- diff --git a/modules/removing-bare-metal-hosts-from-provisioner.adoc b/modules/removing-bare-metal-hosts-from-provisioner.adoc index d87f3341f480..f06af3e7d9b5 100644 --- a/modules/removing-bare-metal-hosts-from-provisioner.adoc +++ b/modules/removing-bare-metal-hosts-from-provisioner.adoc @@ -42,4 +42,4 @@ When you use a `BareMetalHost` object to create a machine in the cluster and lab [source,terminal] ---- $ oc annotate machineset -n openshift-machine-api 'baremetalhost.metal3.io/detached-' ----- \ No newline at end of file +---- diff --git a/scalability_and_performance/managing-bare-metal-hosts.adoc b/scalability_and_performance/managing-bare-metal-hosts.adoc index 13319e353022..43503ae50b01 100644 --- a/scalability_and_performance/managing-bare-metal-hosts.adoc +++ b/scalability_and_performance/managing-bare-metal-hosts.adoc @@ -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] @@ -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]