Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 11. Managing bare-metal hosts
When you install OpenShift Container Platform on a bare-metal cluster, you can provision and manage bare-metal nodes by using
machine
machineset
11.1. About bare metal hosts and nodes Link kopierenLink in die Zwischenablage kopiert!
To provision a Red Hat Enterprise Linux CoreOS (RHCOS) bare metal host as a node in your cluster, first create a
MachineSet
Machine
MachineSet
metal3.io/autoscale-to-hosts
Machine
MachineSet
11.2. Maintaining bare metal hosts Link kopierenLink in die Zwischenablage kopiert!
You can maintain the details of the bare metal hosts in your cluster from the OpenShift Container Platform web console. Navigate to Compute
You can move a bare metal host into maintenance mode. When you move a host into maintenance mode, the scheduler moves all managed workloads off the corresponding bare metal node. No new workloads are scheduled while in maintenance mode.
You can deprovision a bare metal host in the web console. Deprovisioning a host does the following actions:
-
Annotates the bare metal host CR with
cluster.k8s.io/delete-machine: true - Scales down the related compute machine set
Powering off the host without first moving the daemon set and unmanaged static pods to another node can cause service disruption and loss of data.
11.2.1. Adding a bare metal host to the cluster using the web console Link kopierenLink in die Zwischenablage kopiert!
You can add bare metal hosts to the cluster in the web console.
Prerequisites
- Install an RHCOS cluster on bare metal.
-
Log in as a user with privileges.
cluster-admin
Procedure
-
In the web console, navigate to Compute
Bare Metal Hosts. -
Select Add Host
New with Dialog. - Specify a unique name for the new bare metal host.
- Set the Boot MAC address.
- Set the Baseboard Management Console (BMC) Address.
- Enter the user credentials for the host’s baseboard management controller (BMC).
- Select to power on the host after creation, and select Create.
-
Scale up the number of replicas to match the number of available bare metal hosts. Navigate to Compute
MachineSets, and increase the number of machine replicas in the cluster by selecting Edit Machine count from the Actions drop-down menu.
You can also manage the number of bare metal nodes using the
oc scale
11.2.2. Adding a bare metal host to the cluster using YAML in the web console Link kopierenLink in die Zwischenablage kopiert!
You can add bare metal hosts to the cluster in the web console using a YAML file that describes the bare metal host.
Prerequisites
- Install a RHCOS compute machine on bare metal infrastructure for use in the cluster.
-
Log in as a user with privileges.
cluster-admin -
Create a CR for the bare metal host.
Secret
Procedure
-
In the web console, navigate to Compute
Bare Metal Hosts. -
Select Add Host
New from YAML. Copy and paste the below YAML, modifying the relevant fields with the details of your host:
apiVersion: metal3.io/v1alpha1 kind: BareMetalHost metadata: name: <bare_metal_host_name> spec: online: true bmc: address: <bmc_address> credentialsName: <secret_credentials_name>1 disableCertificateVerification: True2 bootMACAddress: <host_boot_mac_address>- 1
credentialsNamemust reference a validSecretCR. Thebaremetal-operatorcannot manage the bare metal host without a validSecretreferenced in thecredentialsName. For more information about secrets and how to create them, see Understanding secrets.- 2
- Setting
disableCertificateVerificationtotruedisables TLS host validation between the cluster and the baseboard management controller (BMC).
- Select Create to save the YAML and create the new bare metal host.
Scale up the number of replicas to match the number of available bare metal hosts. Navigate to Compute
MachineSets, and increase the number of machines in the cluster by selecting Edit Machine count from the Actions drop-down menu. NoteYou can also manage the number of bare metal nodes using the
command and the appropriate bare metal compute machine set.oc scale
11.2.3. Automatically scaling machines to the number of available bare metal hosts Link kopierenLink in die Zwischenablage kopiert!
To automatically create the number of
Machine
BareMetalHost
metal3.io/autoscale-to-hosts
MachineSet
Prerequisites
-
Install RHCOS bare metal compute machines for use in the cluster, and create corresponding objects.
BareMetalHost -
Install the OpenShift Container Platform CLI ().
oc -
Log in as a user with privileges.
cluster-admin
Procedure
Annotate the compute machine set that you want to configure for automatic scaling by adding the
annotation. Replacemetal3.io/autoscale-to-hostswith the name of the compute machine set.<machineset>$ oc annotate machineset <machineset> -n openshift-machine-api 'metal3.io/autoscale-to-hosts=<any_value>'Wait for the new scaled machines to start.
When you use a
BareMetalHost
BareMetalHost
BareMetalHost
MachineSet
Machine
11.2.4. Removing bare metal hosts from the provisioner node Link kopierenLink in die Zwischenablage kopiert!
In certain circumstances, you might want to temporarily remove bare metal hosts from the provisioner node. For example, during provisioning when a bare metal host reboot is triggered by using the OpenShift Container Platform administration console or as a result of a Machine Config Pool update, OpenShift Container Platform logs into the integrated Dell Remote Access Controller (iDrac) and issues a delete of the job queue.
To prevent the management of the number of
Machine
BareMetalHost
baremetalhost.metal3.io/detached
MachineSet
This annotation has an effect for only
BareMetalHost
Provisioned
ExternallyProvisioned
Ready/Available
Prerequisites
-
Install RHCOS bare metal compute machines for use in the cluster and create corresponding objects.
BareMetalHost -
Install the OpenShift Container Platform CLI ().
oc -
Log in as a user with privileges.
cluster-admin
Procedure
Annotate the compute machine set that you want to remove from the provisioner node by adding the
annotation.baremetalhost.metal3.io/detached$ oc annotate machineset <machineset> -n openshift-machine-api 'baremetalhost.metal3.io/detached'Wait for the new machines to start.
NoteWhen you use a
object to create a machine in the cluster and labels or selectors are subsequently changed on theBareMetalHost, theBareMetalHostobject continues be counted against theBareMetalHostthat theMachineSetobject was created from.MachineIn the provisioning use case, remove the annotation after the reboot is complete by using the following command:
$ oc annotate machineset <machineset> -n openshift-machine-api 'baremetalhost.metal3.io/detached-'
11.2.5. Powering off bare-metal hosts Link kopierenLink in die Zwischenablage kopiert!
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
Prerequisites
- You have installed a RHCOS compute machine on bare-metal infrastructure for use in the cluster.
-
You have logged in as a user with privileges.
cluster-admin -
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 custom resource (CR) in the cluster or by logging in to the web console and configuring the bare-metal host to be managed.
Secret
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
resource for the host that you want to power off by usingBareMetalHost.ocGet the name of the managed bare-metal host. Run the following command:
$ oc get baremetalhosts -n openshift-machine-api -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.provisioning.state}{"\n"}{end}'Example output
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 managedMark the node as unschedulable:
$ 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:
$ oc adm drain <bare_metal_host> --force=truePods 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:
$ 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:
$ oc adm uncordon <bare_metal_host>