Skip to content

Commit 98f0345

Browse files
committed
[OSDOCS-15345]: Adding bare metal infra docs for HCP
1 parent fa7c2f8 commit 98f0345

File tree

3 files changed

+346
-0
lines changed

3 files changed

+346
-0
lines changed

hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ include::modules/hcp-bm-dns.adoc[leveloffset=+1]
5353

5454
include::modules/hcp-custom-dns.adoc[leveloffset=+2]
5555

56+
[id="hcp-bm-create-infra_{context}"]
57+
== Creating an InfraEnv resource
58+
59+
Before you can create a hosted cluster on bare metal, you need an `InfraEnv` resource.
60+
61+
include::modules/hcp-bm-add-nodes-to-inventory.adoc[leveloffset=+2]
62+
63+
include::modules/hcp-bm-create-infra-console.adoc[leveloffset=+2]
64+
65+
[discrete]
66+
[role="_additional-resources"]
67+
[id="addl-res-hcp-bm-infra-console_{context}"]
68+
=== Additional resources
69+
70+
* xref:../../web_console/web-console.adoc#web-console-overview[Accessing the web console]
71+
5672
include::modules/hcp-bm-hc.adoc[leveloffset=+1]
5773

5874
[role="_additional-resources"]
Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
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+
= Creating an InfraEnv resource and adding nodes
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+
74+
. Apply the changes to the YAML file by entering the following command:
75+
+
76+
[source,terminal]
77+
----
78+
$ oc apply -f <infraenv_config>.yaml
79+
----
80+
+
81+
Replace `<infraenv_config>` with the name of your file.
82+
83+
. Verify that the `InfraEnv` resource was created by entering the following command:
84+
+
85+
[source,terminal]
86+
----
87+
$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig \
88+
-n <namespace_example> get infraenv hosted
89+
----
90+
91+
. Add bare-metal hosts by following one of two methods:
92+
93+
** If you do not use the Metal3 Operator, obtain the discovery ISO from the `InfraEnv` resource and boot the hosts manually by completing the following steps:
94+
95+
.. Download the live ISO by entering the following commands:
96+
+
97+
[source,terminal]
98+
----
99+
$ oc get infraenv -A
100+
----
101+
+
102+
[source,terminal]
103+
----
104+
$ oc get infraenv <namespace_example> -o jsonpath='{.status.isoDownloadURL}' -n <namespace_example> <iso_url>
105+
----
106+
107+
.. Boot the ISO. The node communicates with the Assisted Service and registers as an agent in the same namespace as the `InfraEnv` resource.
108+
109+
.. For each agent, set the installation disk ID and hostname, and approve it to indicate that the agent is ready for use. Enter the following commands:
110+
+
111+
[source,terminal]
112+
----
113+
$ oc -n <hosted_control_plane_namespace> get agents
114+
----
115+
+
116+
.Example output
117+
[source,terminal]
118+
----
119+
NAME CLUSTER APPROVED ROLE STAGE
120+
86f7ac75-4fc4-4b36-8130-40fa12602218 auto-assign
121+
e57a637f-745b-496e-971d-1abbf03341ba auto-assign
122+
----
123+
+
124+
[source,terminal]
125+
----
126+
$ oc -n <hosted_control_plane_namespace> \
127+
patch agent 86f7ac75-4fc4-4b36-8130-40fa12602218 \
128+
-p '{"spec":{"installation_disk_id":"/dev/sda","approved":true,"hostname":"worker-0.example.krnl.es"}}' \
129+
--type merge
130+
----
131+
+
132+
[source,terminal]
133+
----
134+
$ oc -n <hosted_control_plane_namespace> \
135+
patch agent 23d0c614-2caa-43f5-b7d3-0b3564688baa -p \
136+
'{"spec":{"installation_disk_id":"/dev/sda","approved":true,"hostname":"worker-1.example.krnl.es"}}' \
137+
--type merge
138+
----
139+
+
140+
[source,terminal]
141+
----
142+
$ oc -n <hosted_control_plane_namespace> get agents
143+
----
144+
+
145+
.Example output
146+
[source,terminal]
147+
----
148+
NAME CLUSTER APPROVED ROLE STAGE
149+
86f7ac75-4fc4-4b36-8130-40fa12602218 true auto-assign
150+
e57a637f-745b-496e-971d-1abbf03341ba true auto-assign
151+
----
152+
153+
** If you use the Metal3 Operator, you can automate the bare-metal host registration by creating the following objects:
154+
155+
.. Create a YAML file and add the following content to it:
156+
+
157+
[source,yaml]
158+
----
159+
apiVersion: v1
160+
kind: Secret
161+
metadata:
162+
name: hosted-worker0-bmc-secret
163+
namespace: <namespace_example>
164+
data:
165+
password: <password>
166+
username: <username>
167+
type: Opaque
168+
---
169+
apiVersion: v1
170+
kind: Secret
171+
metadata:
172+
name: hosted-worker1-bmc-secret
173+
namespace: <namespace_example>
174+
data:
175+
password: <password>
176+
username: <username>
177+
type: Opaque
178+
---
179+
apiVersion: v1
180+
kind: Secret
181+
metadata:
182+
name: hosted-worker2-bmc-secret
183+
namespace: <namespace_example>
184+
data:
185+
password: <password>
186+
username: <username>
187+
type: Opaque
188+
---
189+
apiVersion: metal3.io/v1alpha1
190+
kind: BareMetalHost
191+
metadata:
192+
name: hosted-worker0
193+
namespace: <namespace_example>
194+
labels:
195+
infraenvs.agent-install.openshift.io: hosted
196+
annotations:
197+
inspect.metal3.io: disabled
198+
bmac.agent-install.openshift.io/hostname: hosted-worker0
199+
spec:
200+
automatedCleaningMode: disabled
201+
bmc:
202+
disableCertificateVerification: True
203+
address: <bmc_address>
204+
credentialsName: hosted-worker0-bmc-secret
205+
bootMACAddress: aa:aa:aa:aa:02:01
206+
online: true
207+
---
208+
apiVersion: metal3.io/v1alpha1
209+
kind: BareMetalHost
210+
metadata:
211+
name: hosted-worker1
212+
namespace: <namespace_example>
213+
labels:
214+
infraenvs.agent-install.openshift.io: hosted
215+
annotations:
216+
inspect.metal3.io: disabled
217+
bmac.agent-install.openshift.io/hostname: hosted-worker1
218+
spec:
219+
automatedCleaningMode: disabled
220+
bmc:
221+
disableCertificateVerification: True
222+
address: <bmc_address>
223+
credentialsName: hosted-worker1-bmc-secret
224+
bootMACAddress: aa:aa:aa:aa:02:02
225+
online: true
226+
---
227+
apiVersion: metal3.io/v1alpha1
228+
kind: BareMetalHost
229+
metadata:
230+
name: hosted-worker2
231+
namespace: <namespace_example>
232+
labels:
233+
infraenvs.agent-install.openshift.io: hosted
234+
annotations:
235+
inspect.metal3.io: disabled
236+
bmac.agent-install.openshift.io/hostname: hosted-worker2
237+
spec:
238+
automatedCleaningMode: disabled
239+
bmc:
240+
disableCertificateVerification: True
241+
address: <bmc_address>
242+
credentialsName: hosted-worker2-bmc-secret
243+
bootMACAddress: aa:aa:aa:aa:02:03
244+
online: true
245+
---
246+
apiVersion: rbac.authorization.k8s.io/v1
247+
kind: Role
248+
metadata:
249+
name: capi-provider-role
250+
namespace: <namespace_example>
251+
rules:
252+
- apiGroups:
253+
- agent-install.openshift.io
254+
resources:
255+
- agents
256+
verbs:
257+
- '*'
258+
----
259+
+
260+
where:
261+
+
262+
<namespace_example>:: Is the your namespace.
263+
<password>:: Is the password for your secret.
264+
<username>:: Is the user name for your secret.
265+
<bmc_address>:: Is the BMC address for the `BareMetalHost` object.
266+
+
267+
[NOTE]
268+
====
269+
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.
270+
====
271+
272+
.. Apply the changes to the YAML file by entering the following command:
273+
+
274+
[source,terminal]
275+
----
276+
$ oc apply -f <bare_metal_host_config>.yaml
277+
----
278+
+
279+
Replace `<bare_metal_host_config>` with the name of your file.
280+
281+
. Enter the following command, and then wait a few minutes for the `BareMetalHost` objects to move to the `Provisioning` state:
282+
+
283+
[source,terminal]
284+
----
285+
$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig -n <namespace_example> get bmh
286+
----
287+
+
288+
.Example output
289+
[source,terminal]
290+
----
291+
NAME STATE CONSUMER ONLINE ERROR AGE
292+
hosted-worker0 provisioning true 106s
293+
hosted-worker1 provisioning true 106s
294+
hosted-worker2 provisioning true 106s
295+
----
296+
297+
. 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.
298+
+
299+
[source,terminal]
300+
----
301+
$ oc --kubeconfig ~/<directory_example>/mgmt-kubeconfig -n <namespace_example> get agent
302+
----
303+
+
304+
.Example output
305+
[source,terminal]
306+
----
307+
NAME CLUSTER APPROVED ROLE STAGE
308+
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0201 true auto-assign
309+
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0202 true auto-assign
310+
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa0203 true auto-assign
311+
----
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="hcp-bm-create-infra-console_{context}"]
7+
= Creating an InfraEnv resource by using the console
8+
9+
To create an `InfraEnv` resource by using the console, complete the following steps.
10+
11+
.Procedure
12+
13+
. Open the {product-title} web console and log in by entering your administrator credentials. For instructions to open the console, see "Accessing the web console".
14+
15+
. In the console header, ensure that **All Clusters** is selected.
16+
17+
. Click **Infrastructure -> Host inventory -> Create infrastructure environment**.
18+
19+
. After you create the `InfraEnv` resource, add bare-metal hosts from within the **InfraEnv** view by clicking **Add hosts** and selecting from the available options.

0 commit comments

Comments
 (0)