|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc |
| 4 | + |
| 5 | + |
| 6 | +:_mod-docs-content-type: PROCEDURE |
| 7 | +[id="hcp-bm-add-nodes-to-inventory_{context}"] |
| 8 | += Adding bare-metal nodes to a hardware inventory |
| 9 | + |
| 10 | +On {hcp}, the control-plane components run as pods on the management cluster while the data plane runs on dedicated nodes. You can use the Assisted Service to boot your hardware with a discovery ISO that adds your hardware to a hardware inventory. Later, when you create a hosted cluster, the hardware from the inventory is used to provision the data-plane nodes. The object that is used to get the discovery ISO is an `InfraEnv` resource. You need to create a `BareMetalHost` object that configures the cluster to boot the bare-metal node from the discovery ISO. |
| 11 | + |
| 12 | +.Procedure |
| 13 | + |
| 14 | +. Create a namespace to store your hardware inventory by entering the following command: |
| 15 | ++ |
| 16 | +[source,terminal] |
| 17 | +---- |
| 18 | +$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig create \ |
| 19 | + namespace <namespace_example> |
| 20 | +---- |
| 21 | ++ |
| 22 | +where: |
| 23 | ++ |
| 24 | +<directory_example>:: Is the name of the directory where the kubeconfig file for the management cluster is saved. |
| 25 | +<namespace_example>:: Is the name of the namespace that you are creating; for example, `hardware-inventory`. |
| 26 | ++ |
| 27 | +.Example output |
| 28 | +[source,terminal] |
| 29 | +---- |
| 30 | +namespace/hardware-inventory created |
| 31 | +---- |
| 32 | + |
| 33 | +. Copy the pull secret of the management cluster by entering the following command: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig \ |
| 38 | + -n openshift-config get secret pull-secret -o yaml \ |
| 39 | + | grep -vE "uid|resourceVersion|creationTimestamp|namespace" \ |
| 40 | + | sed "s/openshift-config/<namespace_example>/g" \ |
| 41 | + | oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig \ |
| 42 | + -n <namespace> apply -f - |
| 43 | +---- |
| 44 | ++ |
| 45 | +where: |
| 46 | ++ |
| 47 | +<directory_example>:: Is the name of the directory where the kubeconfig file for the management cluster is saved. |
| 48 | +<namespace_example>:: Is the name of the namespace that you are creating; for example, `hardware-inventory`. |
| 49 | ++ |
| 50 | +.Example output |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +secret/pull-secret created |
| 54 | +---- |
| 55 | + |
| 56 | +. Create the InfraEnv resource by adding the following content to a YAML file: |
| 57 | ++ |
| 58 | +[source,yaml] |
| 59 | +---- |
| 60 | +apiVersion: agent-install.openshift.io/v1beta1 |
| 61 | +kind: InfraEnv |
| 62 | +metadata: |
| 63 | + name: hosted |
| 64 | + namespace: <namespace_example> |
| 65 | +spec: |
| 66 | + additionalNTPSources: |
| 67 | + - <ip_address> |
| 68 | + pullSecretRef: |
| 69 | + name: pull-secret |
| 70 | + sshAuthorizedKey: <ssh_public_key> |
| 71 | +---- |
| 72 | + |
| 73 | +. Apply the changes to the YAML file by entering the following command: |
| 74 | ++ |
| 75 | +[source,terminal] |
| 76 | +---- |
| 77 | +$ oc apply -f <infraenv_config>.yaml |
| 78 | +---- |
| 79 | ++ |
| 80 | +Replace `<infraenv_config>` with the name of your file. |
| 81 | + |
| 82 | +. Verify that the `InfraEnv` resource was created by entering the following command: |
| 83 | ++ |
| 84 | +[source,terminal] |
| 85 | +---- |
| 86 | +$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig \ |
| 87 | + -n <namespace_example> get infraenv hosted |
| 88 | +---- |
| 89 | + |
| 90 | +. Create `BareMetalHost` objects by adding the following content to a YAML file: |
| 91 | ++ |
| 92 | +[NOTE] |
| 93 | +==== |
| 94 | +When you apply this YAML file the following objects are created: secrets with credentials for the Baseboard Management Controller (BMCs), the `BareMetalHost` objects, and a role for the HyperShift Operator to be able to manage the agents. Notice how the `InfraEnv` resource is referenced in the `BareMetalHost` objects by using the `infraenvs.agent-install.openshift.io: hosted` custom label. This ensures that the nodes are booted with the ISO generated. |
| 95 | +==== |
| 96 | ++ |
| 97 | +[source,yaml] |
| 98 | +---- |
| 99 | +apiVersion: v1 |
| 100 | +kind: Secret |
| 101 | +metadata: |
| 102 | + name: hosted-worker0-bmc-secret |
| 103 | + namespace: <namespace_example> |
| 104 | +data: |
| 105 | + password: <password> |
| 106 | + username: <username> |
| 107 | +type: Opaque |
| 108 | +--- |
| 109 | +apiVersion: v1 |
| 110 | +kind: Secret |
| 111 | +metadata: |
| 112 | + name: hosted-worker1-bmc-secret |
| 113 | + namespace: <namespace_example> |
| 114 | +data: |
| 115 | + password: <password> |
| 116 | + username: <username> |
| 117 | +type: Opaque |
| 118 | +--- |
| 119 | +apiVersion: v1 |
| 120 | +kind: Secret |
| 121 | +metadata: |
| 122 | + name: hosted-worker2-bmc-secret |
| 123 | + namespace: <namespace_example> |
| 124 | +data: |
| 125 | + password: <password> |
| 126 | + username: <username> |
| 127 | +type: Opaque |
| 128 | +--- |
| 129 | +apiVersion: metal3.io/v1alpha1 |
| 130 | +kind: BareMetalHost |
| 131 | +metadata: |
| 132 | + name: hosted-worker0 |
| 133 | + namespace: <namespace_example> |
| 134 | + labels: |
| 135 | + infraenvs.agent-install.openshift.io: hosted |
| 136 | + annotations: |
| 137 | + inspect.metal3.io: disabled |
| 138 | + bmac.agent-install.openshift.io/hostname: hosted-worker0 |
| 139 | +spec: |
| 140 | + automatedCleaningMode: disabled |
| 141 | + bmc: |
| 142 | + disableCertificateVerification: True |
| 143 | + address: <bmc_address> |
| 144 | + credentialsName: hosted-worker0-bmc-secret |
| 145 | + bootMACAddress: aa:aa:aa:aa:02:01 |
| 146 | + online: true |
| 147 | +--- |
| 148 | +apiVersion: metal3.io/v1alpha1 |
| 149 | +kind: BareMetalHost |
| 150 | +metadata: |
| 151 | + name: hosted-worker1 |
| 152 | + namespace: <namespace_example> |
| 153 | + labels: |
| 154 | + infraenvs.agent-install.openshift.io: hosted |
| 155 | + annotations: |
| 156 | + inspect.metal3.io: disabled |
| 157 | + bmac.agent-install.openshift.io/hostname: hosted-worker1 |
| 158 | +spec: |
| 159 | + automatedCleaningMode: disabled |
| 160 | + bmc: |
| 161 | + disableCertificateVerification: True |
| 162 | + address: <bmc_address> |
| 163 | + credentialsName: hosted-worker1-bmc-secret |
| 164 | + bootMACAddress: aa:aa:aa:aa:02:02 |
| 165 | + online: true |
| 166 | +--- |
| 167 | +apiVersion: metal3.io/v1alpha1 |
| 168 | +kind: BareMetalHost |
| 169 | +metadata: |
| 170 | + name: hosted-worker2 |
| 171 | + namespace: <namespace_example> |
| 172 | + labels: |
| 173 | + infraenvs.agent-install.openshift.io: hosted |
| 174 | + annotations: |
| 175 | + inspect.metal3.io: disabled |
| 176 | + bmac.agent-install.openshift.io/hostname: hosted-worker2 |
| 177 | +spec: |
| 178 | + automatedCleaningMode: disabled |
| 179 | + bmc: |
| 180 | + disableCertificateVerification: True |
| 181 | + address: <bmc_address> |
| 182 | + credentialsName: hosted-worker2-bmc-secret |
| 183 | + bootMACAddress: aa:aa:aa:aa:02:03 |
| 184 | + online: true |
| 185 | +--- |
| 186 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 187 | +kind: Role |
| 188 | +metadata: |
| 189 | + name: capi-provider-role |
| 190 | + namespace: <namespace_example> |
| 191 | +rules: |
| 192 | +- apiGroups: |
| 193 | + - agent-install.openshift.io |
| 194 | + resources: |
| 195 | + - agents |
| 196 | + verbs: |
| 197 | + - '*' |
| 198 | +---- |
| 199 | ++ |
| 200 | +where: |
| 201 | ++ |
| 202 | +<namespace_example>:: Is the your namespace. |
| 203 | +<password>:: Is the password for your secret. |
| 204 | +<username>:: Is the user name for your secret. |
| 205 | +<bmc_address>:: Is the BMC address for the `BareMetalHost` object. |
| 206 | + |
| 207 | +. Apply the changes to the YAML file by entering the following command: |
| 208 | ++ |
| 209 | +[source,terminal] |
| 210 | +---- |
| 211 | +$ oc apply -f <bare_metal_host_config>.yaml |
| 212 | +---- |
| 213 | ++ |
| 214 | +Replace `<bare_metal_host_config>` with the name of your file. |
| 215 | + |
| 216 | +. Enter the following command, and then wait a few minutes for the `BareMetalHost` objects to move to the `Provisioning` state: |
| 217 | ++ |
| 218 | +[source,terminal] |
| 219 | +---- |
| 220 | +$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig -n <namespace_example> get bmh |
| 221 | +---- |
| 222 | ++ |
| 223 | +.Example output |
| 224 | +[source,terminal] |
| 225 | +---- |
| 226 | +NAME STATE CONSUMER ONLINE ERROR AGE |
| 227 | +hosted-worker0 provisioning true 106s |
| 228 | +hosted-worker1 provisioning true 106s |
| 229 | +hosted-worker2 provisioning true 106s |
| 230 | +---- |
| 231 | + |
| 232 | +. Enter the following command to verify that nodes are booting and showing up as agents. This process can take a few minutes, and you might need to enter the command more than once. |
| 233 | ++ |
| 234 | +[source,terminal] |
| 235 | +---- |
| 236 | +$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig -n <namespace_example> get agent |
| 237 | +---- |
| 238 | ++ |
| 239 | +.Example output |
| 240 | +[source,terminal] |
| 241 | +---- |
| 242 | +NAME CLUSTER APPROVED ROLE STAGE |
| 243 | +aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0201 true auto-assign |
| 244 | +aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0202 true auto-assign |
| 245 | +aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0203 true auto-assign |
| 246 | +---- |
0 commit comments