Skip to content

Commit 1154dc9

Browse files
committed
TELCODOCS-212: Adds functionality for configuring host interfaces using NMState..
1 parent f4893ca commit 1154dc9

5 files changed

+116
-33
lines changed

installing/installing_bare_metal_ipi/ipi-install-installation-workflow.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ include::modules/ipi-install-modifying-install-config-for-no-provisioning-networ
2626

2727
include::modules/ipi-install-modifying-install-config-for-dual-stack-network.adoc[leveloffset=+2]
2828

29+
include::modules/ipi-install-configuring-host-network-interfaces-in-the-install-config.yaml-file.adoc[leveloffset=+2]
30+
2931
include::modules/ipi-install-configuring-managed-secure-boot-in-the-install-config-file.adoc[leveloffset=+2]
3032

3133
include::modules/ipi-install-additional-install-config-parameters.adoc[leveloffset=+2]
@@ -50,7 +52,6 @@ ifeval::[{product-version} > 4.8]
5052
include::modules/ipi-install-configuring-bios-for-worker-node.adoc[leveloffset=+2]
5153
endif::[]
5254

53-
5455
include::modules/ipi-install-creating-a-disconnected-registry.adoc[leveloffset=+1]
5556

5657
include::modules/ipi-install-deploying-routers-on-worker-nodes.adoc[leveloffset=+1]

modules/ipi-install-additional-install-config-parameters.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,9 @@ The `hosts` parameter is a list of separate bare metal assets used to build the
206206
|
207207
| The MAC address of the NIC that the host uses for the `provisioning` network. Ironic retrieves the IP address using the `bootMACAddress` configuration setting. Then, it binds to the host.
208208

209+
210+
| `networkConfig`
211+
|
212+
| Set this optional parameter to configure the network interface of a host. See "(Optional) Configuring host network interfaces in the `install-config.yaml` file" for additional details.
213+
209214
|===
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// This is included in the following assemblies:
2+
//
3+
// installing_bare_metal_ipi/ipi-install-installation-workflow.adoc
4+
5+
[id="configuring-host-network-interfaces-in-the-install-config.yaml-file_{context}"]
6+
= (Optional) Configuring host network interfaces in the `install-config.yaml` file
7+
8+
During installation, you can set the `networkConfig` configuration setting in the `install-config.yaml` file to configure host network interfaces using NMState. To use the `networkConfig` configuration setting, you must provide an NMState YAML configuration. See link:https://nmstate.io/examples.html#interfaces-ethernet[NMState] for additional examples of the NMState syntax.
9+
10+
.Example
11+
[source,yaml]
12+
----
13+
hosts:
14+
- name: openshift-master-0
15+
role: master
16+
bmc:
17+
address: redfish+http://<out-of-band-ip>/redfish/v1/Systems/
18+
username: <user>
19+
password: <password>
20+
disableCertificateVerification: null
21+
bootMACAddress: <NIC1_mac_address>
22+
bootMode: UEFI
23+
rootDeviceHints:
24+
deviceName: "/dev/sda"
25+
networkConfig: <1>
26+
interfaces:
27+
- name: <NIC1_name>
28+
type: ethernet
29+
state: up
30+
ipv4:
31+
address:
32+
- ip: "<IP_address>"
33+
prefix-length: 24
34+
enabled: true
35+
dns-resolver:
36+
config:
37+
server:
38+
- <DNS_IP_address>
39+
routes:
40+
config:
41+
- destination: 0.0.0.0/0
42+
next-hop-address: <IP_address>
43+
next-hop-interface: <NIC1_name>
44+
----
45+
<1> Add NMState YAML syntax to configure host interfaces.
46+
47+
[TIP]
48+
====
49+
Consider saving the `networkConfig` YAML syntax to a file and testing it using the NMState command line interface before including it in the `install-config.yaml` file, because the installer will not check the NMState YAML syntax. Execute `nmstatectl gc <yaml-config>` to test the syntax. Errors in the YAML syntax might result in a failure to apply the network configuration. Additionally, maintaining the validated YAML syntax is useful when applying changes using Kubernetes NMState after deployment or when expanding the cluster.
50+
====
51+
52+
The most common use case for this functionality is to specify a static IP address on the `baremetal` network, but you can also configure other networks such as a storage network. This functionality will also support other NMState features such as VLAN, VXLAN, bridges, bonds, routes, MTU, and DNS resolver settings.
53+
54+
[IMPORTANT]
55+
====
56+
Once deployed, you cannot modify the `networkConfig` configuration setting of `install-config.yaml` file to make changes to the host network interface. Use the Kubernetes NMState Operator to make changes to the host network interface after deployment.
57+
====

modules/ipi-install-network-requirements.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ For the `baremetal` network, a network administrator must reserve a number of IP
104104
[IMPORTANT]
105105
.Reserving IP addresses so they become static IP addresses
106106
====
107-
Some administrators prefer to use static IP addresses so that each node's IP address remains constant in the absence of a DHCP server. To use static IP addresses in the {product-title} cluster, reserve the IP addresses with an infinite lease. During deployment, the installer will reconfigure the NICs from DHCP assigned addresses to static IP addresses. NICs with DHCP leases that are not infinite will remain configured to use DHCP.
107+
Some administrators prefer to use static IP addresses so that each node's IP address remains constant in the absence of a DHCP server. To configure static IP addresses with NMState, see "(Optional) Configuring host network interfaces in the `install-config.yaml` file" in the "Setting up the environment for an OpenShift installation" section.
108108
====
109109

110110
[IMPORTANT]

modules/ipi-install-preparing-the-bare-metal-node.adoc

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
11
// This is included in the following assemblies:
22
//
3-
// ipi-install-expanding-the-cluster.adoc
3+
// installing/installing_bare_metal_ipi/ipi-install-expanding-the-cluster.adoc
44

55
[id='preparing-the-bare-metal-node_{context}']
6-
76
= Preparing the bare metal node
87

98
Expanding the cluster requires a DHCP server. Each node must have a DHCP reservation.
109

11-
ifeval::[{product-version}>4.6]
1210
[IMPORTANT]
1311
.Reserving IP addresses so they become static IP addresses
1412
====
15-
Some administrators prefer to use static IP addresses so that each node's IP address remains constant in the absence of a DHCP server. To use static IP addresses in the {product-title} cluster, *reserve the IP addresses in the DHCP server with an infinite lease*. After the installer provisions the node successfully, the dispatcher script will check the node's network configuration. If the dispatcher script finds that the network configuration contains a DHCP infinite lease, it will recreate the connection as a static IP connection using the IP address from the DHCP infinite lease. NICs without DHCP infinite leases will remain unmodified.
13+
Some administrators prefer to use static IP addresses so that each node's IP address remains constant in the absence of a DHCP server. To configure static IP addresses with NMState, see "(Optional) Configuring host network interfaces in the `install-config.yaml` file" in the "Setting up the environment for an OpenShift installation" section for additional details.
1614
====
17-
endif::[]
15+
1816

1917
Preparing the bare metal node requires executing the following procedure from the provisioner node.
2018

2119
.Procedure
2220

2321
. Get the `oc` binary, if needed. It should already exist on the provisioner node.
2422
+
25-
[source,bash]
23+
[source,terminal]
2624
----
2725
[kni@provisioner ~]$ curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/openshift-client-linux-$VERSION.tar.gz | tar zxvf - oc
2826
----
2927
+
30-
[source,bash]
28+
[source,terminal]
3129
----
3230
[kni@provisioner ~]$ sudo cp oc /usr/local/bin
3331
----
3432

35-
. Power off the bare metal node via the baseboard management controller and ensure it is off.
33+
. Power off the bare metal node through the baseboard management controller and ensure it is off.
3634

37-
. Retrieve the user name and password of the bare metal node's baseboard management controller. Then, create `base64` strings from the user name and password. In the following example, the user name is `root` and the password is `calvin`.
35+
. Retrieve the user name and password of the bare metal node's baseboard management controller. Then, create `base64` strings from the user name and password. In the following example, the user name is `root` and the password is `password`.
3836
+
39-
[source,bash]
37+
[source,terminal]
4038
----
4139
[kni@provisioner ~]$ echo -ne "root" | base64
4240
----
4341
+
44-
[source,bash]
42+
[source,terminal]
4543
----
46-
[kni@provisioner ~]$ echo -ne "calvin" | base64
44+
[kni@provisioner ~]$ echo -ne "password" | base64
4745
----
4846

4947
. Create a configuration file for the bare metal node.
5048
+
51-
[source,bash]
49+
[source,terminal]
5250
----
5351
[kni@provisioner ~]$ vim bmh.yaml
5452
----
@@ -59,42 +57,63 @@ Preparing the bare metal node requires executing the following procedure from th
5957
apiVersion: v1
6058
kind: Secret
6159
metadata:
62-
name: openshift-worker-<num>-bmc-secret
60+
name: openshift-worker-<num>-bmc-secret <1>
6361
type: Opaque
6462
data:
65-
username: <base64-of-uid>
66-
password: <base64-of-pwd>
63+
username: <base64-of-uid> <2>
64+
password: <base64-of-pwd> <3>
6765
---
6866
apiVersion: metal3.io/v1alpha1
6967
kind: BareMetalHost
7068
metadata:
71-
name: openshift-worker-<num>
69+
name: openshift-worker-<num> <1>
7270
spec:
7371
online: true
74-
bootMACAddress: <NIC1-mac-address>
72+
bootMACAddress: <NIC1-mac-address> <4>
7573
bmc:
76-
address: <protocol>://<bmc-ip>
77-
credentialsName: openshift-worker-<num>-bmc-secret
78-
----
79-
+
80-
Replace `<num>` for the worker number of the bare metal node in the two `name` fields and the `credentialsName` field. Replace `<base64-of-uid>` with the `base64` string of the user name. Replace `<base64-of-pwd>` with the `base64` string of the password. Replace `<NIC1-mac-address>` with the MAC address of the bare metal node's first NIC.
81-
+
82-
See the BMC addressing section for additional BMC configuration options. Replace `<protocol>` with the BMC protocol, such as IPMI, RedFish, or others.
83-
Replace `<bmc-ip>` with the IP address of the bare metal node's baseboard management controller.
74+
address: <protocol>://<bmc-ip> <5>
75+
credentialsName: openshift-worker-<num>-bmc-secret <1>
76+
networkConfig: <6>
77+
interfaces:
78+
- name: <NIC1_name>
79+
type: ethernet
80+
state: up
81+
ipv4:
82+
address:
83+
- ip: "<IP_address>"
84+
prefix-length: 24
85+
enabled: true
86+
dns-resolver:
87+
config:
88+
server:
89+
- <DNS_IP_address>
90+
routes:
91+
config:
92+
- destination: 0.0.0.0/0
93+
next-hop-address: <IP_address>
94+
next-hop-interface: <NIC1_name>
95+
----
96+
<1> Replace `<num>` for the worker number of the bare metal node in the two `name` fields and the `credentialsName` field.
97+
<2> Replace `<base64-of-uid>` with the `base64` string of the user name.
98+
<3> Replace `<base64-of-pwd>` with the `base64` string of the password.
99+
<4> Replace `<NIC1-mac-address>` with the MAC address of the bare metal node's first NIC. See the BMC addressing section for additional BMC configuration options. Replace `<protocol>` with the BMC protocol, such as IPMI, RedFish, or others.
100+
<5> Replace `<bmc-ip>` with the IP address of the bare metal node's baseboard management controller.
101+
<6> Optional. You can set the `networkConfig` configuration option to configure host network interfaces. See "(Optional) Configuring host network interfaces in the `install-config.yaml` file" in the "Setting up the environment for an OpenShift installation" section for configuration details.
84102
+
85103
[NOTE]
86104
====
87-
If the MAC address of an existing bare metal node matches the MAC address of a bare metal host that you are attempting to provision, then the Ironic installation will fail. If the host enrollment, inspection, cleaning, or other Ironic steps fail, the Bare Metal Operator retries the installation continuously. See xref:modules/ipi-install-diagnosing-duplicate-mac-address.adoc#ipi-install-diagnosing-duplicate-mac-address_{context}[Diagnosing a host duplicate MAC address] for more information.
105+
If the MAC address of an existing bare metal node matches the MAC address of a bare metal host that you are attempting to provision, then the Ironic installation will fail. If the host enrollment, inspection, cleaning, or other Ironic steps fail, the Bare Metal Operator retries the installation continuously. See "Diagnosing a host duplicate MAC address" for more information.
88106
====
89107

90108
. Create the bare metal node.
91109
+
92-
[source,bash]
110+
[source,terminal]
93111
----
94112
[kni@provisioner ~]$ oc -n openshift-machine-api create -f bmh.yaml
95113
----
96114
+
97-
[source,bash]
115+
.Example output
116+
[source,terminal]
98117
----
99118
secret/openshift-worker-<num>-bmc-secret created
100119
baremetalhost.metal3.io/openshift-worker-<num> created
@@ -104,14 +123,15 @@ Where `<num>` will be the worker number.
104123

105124
. Power up and inspect the bare metal node.
106125
+
107-
[source,bash]
126+
[source,terminal]
108127
----
109128
[kni@provisioner ~]$ oc -n openshift-machine-api get bmh openshift-worker-<num>
110129
----
111130
+
112131
Where `<num>` is the worker node number.
113132
+
114-
[source,bash]
133+
.Example output
134+
[source,terminal]
115135
----
116136
NAME STATUS PROVISIONING STATUS CONSUMER BMC HARDWARE PROFILE ONLINE ERROR
117137
openshift-worker-<num> OK ready ipmi://<out-of-band-ip> unknown true

0 commit comments

Comments
 (0)