As an alternative to using the configure-ovs.sh shell script to set a br-ex bridge on a bare-metal platform, you can create a MachineConfig object that includes an NMState configuration file. The host nmstate-configuration.service and nmstate.service apply the NMState configuration file to each node that runs in your cluster.
As an alternative to using the configure-ovs.sh shell script to set a br-ex bridge on a bare-metal platform, you can create a NodeNetworkConfigurationPolicy (NNCP) custom resource (CR) that includes an NMState configuration file.
The Kubernetes NMState Operator uses the NMState configuration file to create a customized br-ex bridge network configuration on each node in your cluster.
|
|
After creating the NodeNetworkConfigurationPolicy CR, copy content from the NMState configuration file that was created during cluster installation into the NNCP CR. An incomplete NNCP CR file means that the the network policy described in the file cannot get applied to nodes in the cluster.
|
This feature supports the following tasks:
-
Modifying the maximum transmission unit (MTU) for your cluster.
-
Modifying attributes of a different bond interface, such as MIImon (Media Independent Interface Monitor), bonding mode, or Quality of Service (QoS).
-
Updating DNS values.
Consider the following use cases for creating a manifest object that includes a customized br-ex bridge:
-
You want to make postinstallation changes to the bridge, such as changing the Open vSwitch (OVS) or OVN-Kubernetes br-ex bridge network. The configure-ovs.sh shell script does not support making postinstallation changes to the bridge.
-
You want to deploy the bridge on a different interface than the interface available on a host or server IP address.
-
You want to make advanced configurations to the bridge that are not possible with the configure-ovs.sh shell script. Using the script for these configurations might result in the bridge failing to connect multiple network interfaces and facilitating data forwarding between the interfaces.
|
|
If you require an environment with a single network interface controller (NIC) and default network settings, use the configure-ovs.sh shell script.
|
After you install Fedora CoreOS (FCOS) and the system reboots, the Machine Config Operator injects Ignition configuration files into each node in your cluster, so that each node received the br-ex bridge network configuration. To prevent configuration conflicts, the configure-ovs.sh shell script receives a signal to not configure the br-ex bridge.
Procedure
-
Create a NMState configuration file that has decoded base64 information for your customized br-ex bridge network:
Example of an NMState configuration for a customized br-ex bridge network
interfaces:
- name: enp2s0
type: ethernet
state: up
ipv4:
enabled: false
ipv6:
enabled: false
- name: br-ex
type: ovs-bridge
state: up
ipv4:
enabled: false
dhcp: false
ipv6:
enabled: false
dhcp: false
bridge:
options:
mcast-snooping-enable: true
port:
- name: enp2s0
- name: br-ex
- name: br-ex
type: ovs-interface
state: up
copy-mac-from: enp2s0
ipv4:
enabled: true
dhcp: true
auto-route-metric: 48
ipv6:
enabled: true
dhcp: true
auto-route-metric: 48
# ...
interfaces.name
-
Name of the interface.
interfaces.type
-
The type of ethernet.
interfaces.state
-
The requested state for the interface after creation.
ipv4.enabled
-
Disables IPv4 and IPv6 in this example.
port.name
-
The node NIC to which the bridge attaches.
auto-route-metric
-
Set the parameter to 48 to ensure the br-ex default route always has the highest precedence (lowest metric). This configuration prevents routing conflicts with any other interfaces that are automatically configured by the NetworkManager service.
-
Use the cat command to base64-encode the contents of the NMState configuration:
$ cat <nmstate_configuration>.yml | base64
<nmstate_configuration>
-
Replace <nmstate_configuration> with the name of your NMState resource YAML file.
-
Create a MachineConfig manifest file and define a customized br-ex bridge network configuration analogous to the following example:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: 10-br-ex-worker
spec:
config:
ignition:
version: 3.2.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,<base64_encoded_nmstate_configuration>
mode: 0644
overwrite: true
path: /etc/nmstate/openshift/worker-0.yml
- contents:
source: data:text/plain;charset=utf-8;base64,<base64_encoded_nmstate_configuration>
mode: 0644
overwrite: true
path: /etc/nmstate/openshift/worker-1.yml
# ...
metadata.name
-
The name of the policy.
contents.source
-
Writes the encoded base64 information to the specified path.
path
-
For each node in your cluster, specify the hostname path to your node and the base-64 encoded Ignition configuration file data for the machine type. The worker role is the default role for nodes in your cluster. You must use the .yml extension for configuration files, such as $(hostname -s).yml when specifying the short hostname path for each node or all nodes in the MachineConfig manifest file.
If you have a single global configuration specified in an /etc/nmstate/openshift/cluster.yml configuration file that you want to apply to all nodes in your cluster, you do not need to specify the short hostname path for each node, such as /etc/nmstate/openshift/<node_hostname>.yml. For example:
# ...
- contents:
source: data:text/plain;charset=utf-8;base64,<base64_encoded_nmstate_configuration>
mode: 0644
overwrite: true
path: /etc/nmstate/openshift/cluster.yml
# ...
-
Apply the updates from the MachineConfig object to your cluster by entering the following command:
$ oc apply -f <machine_config>.yml
To apply a customized br-ex bridge configuration to all compute nodes in your OKD cluster, you must edit your MachineConfig custom resource (CR) and modify its roles. Additionally, you must create a BareMetalHost CR that defines information for your bare-metal machine, such as hostname, credentials, and so on.
After you configure these resources, you must scale machine sets, so that the machine sets can apply the resource configuration to each compute node and reboot the nodes.
Procedure
-
Edit the MachineConfig CR by entering the following command:
$ oc edit mc <machineconfig_custom_resource_name>
-
Add each compute node configuration to the CR, so that the CR can manage roles for each defined compute node in your cluster.
-
Create a Secret object named extraworker-secret that has a minimal static IP configuration.
-
Apply the extraworker-secret secret to each node in your cluster by entering the following command. This step provides each compute node access to the Ignition config file.
$ oc apply -f ./extraworker-secret.yaml
-
Create a BareMetalHost resource and specify the network secret in the preprovisioningNetworkDataName parameter:
Example BareMetalHost resource with an attached network secret
apiVersion: metal3.io/v1alpha1
kind: BareMetalHost
spec:
# ...
preprovisioningNetworkDataName: ostest-extraworker-0-network-config-secret
# ...
-
To manage the BareMetalHost object within the openshift-machine-api namespace of your cluster, change to the namespace by entering the following command:
$ oc project openshift-machine-api
-
Get the machine sets:
-
Scale each machine set by entering the following command. You must run this command for each machine set.
$ oc scale machineset <machineset_name> --replicas=<n> (1)
| 1 |
Where <machineset_name> is the name of the machine set and <n> is the number of compute nodes. |