Skip to content

Commit 74b9418

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

File tree

3 files changed

+345
-0
lines changed

3 files changed

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

0 commit comments

Comments
 (0)