|
6 | 6 | [id="configuring-host-network-interfaces-in-the-install-config-yaml-file_{context}"]
|
7 | 7 | = Optional: Configuring host network interfaces
|
8 | 8 |
|
9 |
| -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. |
| 9 | +Before installation, you can set the `networkConfig` configuration setting in the `install-config.yaml` file to configure host network interfaces using NMState. |
10 | 10 |
|
11 |
| -See link:https://nmstate.io/examples.html#interfaces-ethernet[NMState] for additional examples of the NMState syntax. |
| 11 | +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 supports other NMState features such as VLAN, VXLAN, bridges, bonds, routes, MTU, and DNS resolver settings. |
12 | 12 |
|
13 |
| -.Example |
14 |
| -[source,yaml] |
15 |
| ----- |
16 |
| - hosts: |
17 |
| - - name: openshift-master-0 |
18 |
| - role: master |
19 |
| - bmc: |
20 |
| - address: redfish+http://<out-of-band-ip>/redfish/v1/Systems/ |
21 |
| - username: <user> |
22 |
| - password: <password> |
23 |
| - disableCertificateVerification: null |
24 |
| - bootMACAddress: <NIC1_mac_address> |
25 |
| - bootMode: UEFI |
26 |
| - rootDeviceHints: |
27 |
| - deviceName: "/dev/sda" |
28 |
| - networkConfig: <1> |
29 |
| - interfaces: |
30 |
| - - name: <NIC1_name> |
31 |
| - type: ethernet |
32 |
| - state: up |
33 |
| - ipv4: |
34 |
| - address: |
35 |
| - - ip: "<IP_address>" |
36 |
| - prefix-length: 24 |
37 |
| - enabled: true |
38 |
| - dns-resolver: |
39 |
| - config: |
40 |
| - server: |
41 |
| - - <DNS_IP_address> |
42 |
| - routes: |
43 |
| - config: |
44 |
| - - destination: 0.0.0.0/0 |
45 |
| - next-hop-address: <IP_address> |
46 |
| - next-hop-interface: <NIC1_name> |
47 |
| ----- |
48 |
| -<1> Add NMState YAML syntax to configure host interfaces. |
| 13 | +.Prequisites |
| 14 | + |
| 15 | +* Configure a `PTR` DNS record with a valid hostname for each node with a static IP address. |
| 16 | +* Install the NMState CLI (`nmstate`). |
49 | 17 |
|
50 |
| -[TIP] |
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Optional: Consider testing the NMState syntax with `nmstatectl gc` before including it in the `install-config.yaml` file, because the installer will not check the NMState YAML syntax. |
| 21 | ++ |
| 22 | +[NOTE] |
51 | 23 | ====
|
52 |
| -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. |
| 24 | +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. |
53 | 25 | ====
|
54 | 26 |
|
55 |
| -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. |
56 | 27 |
|
| 28 | +.. Create an NMState YAML file: |
| 29 | ++ |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +interfaces: |
| 33 | +- name: <nic1_name> <1> |
| 34 | + type: ethernet |
| 35 | + state: up |
| 36 | + ipv4: |
| 37 | + address: |
| 38 | + - ip: <ip_address> <1> |
| 39 | + prefix-length: 24 |
| 40 | + enabled: true |
| 41 | +dns-resolver: |
| 42 | + config: |
| 43 | + server: |
| 44 | + - <dns_ip_address> <1> |
| 45 | +routes: |
| 46 | + config: |
| 47 | + - destination: 0.0.0.0/0 |
| 48 | + next-hop-address: <next_hop_ip_address> <1> |
| 49 | + next-hop-interface: <next_hop_nic1_name> <1> |
| 50 | +---- |
| 51 | ++ |
| 52 | +<1> Replace `<nic1_name>`, `<ip_address>`, `<dns_ip_address>`, `<next_hop_ip_address>` and `<next_hop_nic1_name>` with appropriate values. |
| 53 | + |
| 54 | +.. Test the configuration file by running the following command: |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +$ nmstatectl gc <nmstate_yaml_file> |
| 59 | +---- |
| 60 | ++ |
| 61 | +Replace `<nmstate_yaml_file>` with the configuration file name. |
| 62 | + |
| 63 | +. Use the `networkConfig` configuration setting by adding the NMState configuration to hosts within the `install-config.yaml` file: |
| 64 | ++ |
| 65 | +[source,yaml] |
| 66 | +---- |
| 67 | + hosts: |
| 68 | + - name: openshift-master-0 |
| 69 | + role: master |
| 70 | + bmc: |
| 71 | + address: redfish+http://<out_of_band_ip>/redfish/v1/Systems/ |
| 72 | + username: <user> |
| 73 | + password: <password> |
| 74 | + disableCertificateVerification: null |
| 75 | + bootMACAddress: <NIC1_mac_address> |
| 76 | + bootMode: UEFI |
| 77 | + rootDeviceHints: |
| 78 | + deviceName: "/dev/sda" |
| 79 | + networkConfig: <1> |
| 80 | + interfaces: |
| 81 | + - name: <nic1_name> <2> |
| 82 | + type: ethernet |
| 83 | + state: up |
| 84 | + ipv4: |
| 85 | + address: |
| 86 | + - ip: <ip_address> <2> |
| 87 | + prefix-length: 24 |
| 88 | + enabled: true |
| 89 | + dns-resolver: |
| 90 | + config: |
| 91 | + server: |
| 92 | + - <dns_ip_address> <2> |
| 93 | + routes: |
| 94 | + config: |
| 95 | + - destination: 0.0.0.0/0 |
| 96 | + next-hop-address: <next_hop_ip_address> <2> |
| 97 | + next-hop-interface: <next_hop_nic1_name> <2> |
| 98 | +---- |
| 99 | +<1> Add the NMState YAML syntax to configure the host interfaces. |
| 100 | +<2> Replace `<nic1_name>`, `<ip_address>`, `<dns_ip_address>`, `<next_hop_ip_address>` and `<next_hop_nic1_name>` with appropriate values. |
| 101 | ++ |
57 | 102 | [IMPORTANT]
|
58 | 103 | ====
|
59 |
| -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. |
| 104 | +After deploying the cluster, 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. |
60 | 105 | ====
|
0 commit comments