Este contenido no está disponible en el idioma seleccionado.
Chapter 1. Observing and updating the node network state and configuration
After you install the Kubernetes NMState Operator, you can use the Operator to observe and update your cluster’s node network state and network configuration.
For more information about how to install the NMState Operator, see Kubernetes NMState Operator.
You cannot provide any configuration that modifies the br-ex bridge, an OVN-Kubernetes-managed Open vSwitch bridge. However, you can configure a customized br-ex bridge.
For more information, see "Creating a manifest object that includes a customized br-ex bridge" in the Deploying installer-provisioned clusters on bare metal document or the Installing a user-provisioned cluster on bare metal document.
1.1. Viewing the network state of a node by using the CLI Copiar enlaceEnlace copiado en el portapapeles!
Node network state is the network configuration for all nodes in the cluster. A NodeNetworkState
object exists on every node in the cluster. This object is periodically updated and captures the state of the network for that node.
Prerequisites
-
You have installed the OpenShift CLI (
oc
).
Procedure
List all the
NodeNetworkState
objects in the cluster:oc get nns
$ oc get nns
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect a
NodeNetworkState
object to view the network on that node. The output in this example has been redacted for clarity:oc get nns node01 -o yaml
$ oc get nns node01 -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the
NodeNetworkState
object is taken from the node. - 2
- The
currentState
contains the complete network configuration for the node, including DNS, interfaces, and routes. - 3
- Timestamp of the last successful update. This is updated periodically as long as the node is reachable and can be used to evalute the freshness of the report.
1.2. Viewing a graphical representation of the network state of a node (NNS) topology from the web console Copiar enlaceEnlace copiado en el portapapeles!
To make the configuration of the node network in the cluster easier to understand, you can view it in the form of a diagram. The NNS topology diagram displays all node components (network interface controllers, bridges, bonds, and VLANs), their properties and configurations, and connections between the nodes.
To open the topology view of the cluster, use the following steps:
In the Administrator view of the OpenShift Container Platform web console, navigate to Networking
Node Network Configuration. The NNS topology diagram opens. Each group of components represents a single node.
- To display the configuration and properties of a node, click inside the border of the node.
- To display the features or the YAML file of a specific component (for example, an interface or a bridge), click the icon of the component.
- The icons of active components have green borders; the icons of disconnected components have red borders.
1.3. Viewing the list of NodeNetworkState resources Copiar enlaceEnlace copiado en el portapapeles!
As an administrator, you can use the OpenShift Container Platform web console to view the list of NodeNetworkState
resources and network interfaces, and access network details.
Procedure
-
Navigate to Networking
Node Network Configuration. Click the List icon.
You can now view the list of
NodeNetworkState
resources and the corresponding interfaces that are created on the nodes.-
You can use Filter based on Interface state, Interface type, and IP, or the search bar based on criteria Name or Label, to narrow down the displayed
NodeNetworkState
resources. -
To access the detailed information about a
NodeNetworkState
resource, click theNodeNetworkState
resource name listed in the Name column . -
To expand and view the Network Details section for the
NodeNetworkState
resource, click the greater than (>) symbol . Alternatively, you can click on each interface type under the Network interface column to view the network details.
-
You can use Filter based on Interface state, Interface type, and IP, or the search bar based on criteria Name or Label, to narrow down the displayed
1.4. The NodeNetworkConfigurationPolicy manifest file Copiar enlaceEnlace copiado en el portapapeles!
A NodeNetworkConfigurationPolicy
(NNCP) manifest file defines policies that the Kubernetes NMState Operator uses to configure networking for nodes that exist in an OpenShift Container Platform cluster.
After you apply a node network policy to a node, the Kubernetes NMState Operator configures the networking configuration for nodes according to the node network policy details.
The following list of interface names are reserved and you cannot use the names with NMstate configurations:
-
br-ext
-
br-int
-
br-local
-
br-nexthop
-
br0
-
ext-vxlan
-
ext
-
genev_sys_*
-
int
-
k8s-*
-
ovn-k8s-*
-
patch-br-*
-
tun0
-
vxlan_sys_*
You can create an NNCP by using either the OpenShift CLI (oc
) or the OpenShift Container Platform web console. As a postinstallation task you can create an NNCP or edit an existing NNCP.
Before you create an NNCP, ensure that you read the "Example policy configurations for different interfaces" document.
If you want to delete an NNCP, you can use the oc delete nncp
command to complete this action. However, this command does not delete any objects, such as a bridge interface.
Deleting the node network policy that added an interface to a node does not change the configuration of the policy on the node. Similarly, removing an interface does not delete the policy, because the Kubernetes NMState Operator re-adds the removed interface whenever a pod or a node is restarted.
To effectively delete the NNCP, the node network policy, and any interfaces would typically require the following actions:
-
Edit the NNCP and remove interface details from the file. Ensure that you do not remove
name
,state
, andtype
parameters from the file. -
Add
state: absent
under theinterfaces.state
section of the NNCP. -
Run
oc apply -f <nncp_file_name>
. After the Kubernetes NMState Operator applies the node network policy to each node in your cluster, any interface that exists on each node is now marked as absent. -
Run
oc delete nncp
to delete the NNCP.
1.6. Managing policy from the web console Copiar enlaceEnlace copiado en el portapapeles!
You can update the node network configuration, such as adding or removing interfaces from nodes, by applying NodeNetworkConfigurationPolicy
manifests to the cluster. Manage the policy from the web console by accessing the list of created policies in the NodeNetworkConfigurationPolicy page under the Networking menu. This page enables you to create, update, monitor, and delete the policies.
1.6.1. Monitoring the policy status Copiar enlaceEnlace copiado en el portapapeles!
You can monitor the policy status from the NodeNetworkConfigurationPolicy page. This page displays all the policies created in the cluster in a tabular format, with the following columns:
- Name
- The name of the policy created.
- Matched nodes
- The count of nodes where the policies are applied. This could be either a subset of nodes based on the node selector or all the nodes on the cluster.
- Node network state
- The enactment state of the matched nodes. You can click on the enactment state and view detailed information on the status.
To find the desired policy, you can filter the list either based on enactment state by using the Filter option, or by using the search option.
1.6.2. Creating a policy Copiar enlaceEnlace copiado en el portapapeles!
You can create a policy by using either a form or YAML in the web console. When creating a policy using a form, you can see how the new policy changes the topology of the nodes in your cluster in real time.
Procedure
-
Navigate to Networking
Node Network Configuration. On the Node Network Configuration page, click Create and select the From Form option.
NoteTo create a policy using YAML, click Create
With YAML option. However, the following steps apply only to the form method. - Optional: Check the Apply this NodeNetworkConfigurationPolicy only to specific subsets of nodes using the node selector checkbox to specify the nodes where the policy must be applied.
- Enter the policy name in the Policy name field.
- Optional: Enter the description of the policy in the Description field.
- Click Next to move to the Policy Interfaces section.
In the Bridging part of the Policy Interfaces section, a bridge interface named
br0
is added by default with preset values in editable fields. If required, edit the values by performing the following steps:- Enter the name of the interface in Interface name field.
- Select the required network state. The default selected state is Up.
Select the type of interface. The available types are Bridge, Bonding, and Ethernet. The default selected value is Bridge.
NoteAddition of a VLAN interface by using the form is not supported. To add a VLAN interface, you must use YAML to create the policy. Once added, you cannot edit the policy by using form.
Optional: In the IP configuration section, check IPv4 checkbox to assign an IPv4 address to the interface, and configure the IP address assignment details:
- Click IP address to configure the interface with a static IP address, or DHCP to auto-assign an IP address.
If you have selected IP address option, enter the IPv4 address in IPV4 address field, and enter the prefix length in Prefix length field.
If you have selected DHCP option, uncheck the options that you want to disable. The available options are Auto-DNS, Auto-routes, and Auto-gateway. All the options are selected by default.
- Optional: Enter the port number in Port field.
- Optional: Check the checkbox Enable STP to enable STP.
- Optional: To add an interface to the policy, click Add another interface to the policy.
- Optional: To remove an interface from the policy, click icon next to the interface.
NoteAlternatively, you can click Edit YAML on the top of the page to continue editing the form using YAML.
- Click Next to go to the Review section of the form.
- Verify the settings and click Create to create the policy.
1.7. Updating the policy Copiar enlaceEnlace copiado en el portapapeles!
1.7.1. Updating the policy by using form Copiar enlaceEnlace copiado en el portapapeles!
Procedure
-
Navigate to Networking
NodeNetworkConfigurationPolicy. -
In the NodeNetworkConfigurationPolicy page, click the
icon placed next to the policy you want to edit, and click Edit.
- Edit the fields that you want to update.
- Click Save.
Addition of a VLAN interface using the form is not supported. To add a VLAN interface, you must use YAML to create the policy. Once added, you cannot edit the policy using form.
1.7.2. Updating the policy by using YAML Copiar enlaceEnlace copiado en el portapapeles!
Procedure
-
Navigate to Networking
NodeNetworkConfigurationPolicy. - In the NodeNetworkConfigurationPolicy page, click the policy name under the Name column for the policy you want to edit.
- Click the YAML tab, and edit the YAML.
- Click Save.
1.7.3. Deleting the policy Copiar enlaceEnlace copiado en el portapapeles!
Procedure
-
Navigate to Networking
NodeNetworkConfigurationPolicy. -
In the NodeNetworkConfigurationPolicy page, click the
icon placed next to the policy you want to delete, and click Delete.
- In the pop-up window, enter the policy name to confirm deletion, and click Delete.
1.8. Managing policy by using the CLI Copiar enlaceEnlace copiado en el portapapeles!
1.8.1. Creating an interface on nodes Copiar enlaceEnlace copiado en el portapapeles!
Create an interface on nodes in the cluster by applying a NodeNetworkConfigurationPolicy
(NNCP) manifest to the cluster. The manifest details the requested configuration for the interface.
By default, the manifest applies to all nodes in the cluster. To add the interface to specific nodes, add the spec: nodeSelector
parameter and the appropriate <key>:<value>
for your node selector.
You can configure multiple nmstate-enabled nodes concurrently. The configuration applies to 50% of the nodes in parallel. This strategy prevents the entire cluster from being unavailable if the network connection fails. To apply the policy configuration in parallel to a specific portion of the cluster, use the maxUnavailable
parameter in the NodeNetworkConfigurationPolicy
manifest configuration file.
If you have two nodes and you apply an NNCP manifest with the maxUnavailable
parameter set to 50%
to these nodes, one node at a time receives the NNCP configuration. If you then introduce an additional NNCP manifest file with the maxUnavailable
parameter set to 50%
, this NCCP is independent of the initial NNCP; this means that if both NNCP manifests apply a bad configuration to nodes, you can no longer guarantee that half of your cluster is functional.
Prerequisites
-
You have installed the OpenShift CLI (
oc
).
Procedure
Create the
NodeNetworkConfigurationPolicy
manifest. The following example configures a Linux bridge on all worker nodes and configures the DNS resolver:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses the
node-role.kubernetes.io/worker: ""
node selector to select all worker nodes in the cluster. - 4
- Optional: Specifies the maximum number of nmstate-enabled nodes that the policy configuration can be applied to concurrently. This parameter can be set to either a percentage value (string), for example,
"10%"
, or an absolute value (number), such as3
. - 5
- Optional: Human-readable description for the interface.
- 6
- Optional: Specifies the search and server settings for the DNS server.
Create the node network policy:
oc apply -f br1-eth1-policy.yaml
$ oc apply -f br1-eth1-policy.yaml
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- File name of the node network configuration policy manifest.
1.10. Example policy configurations for different interfaces Copiar enlaceEnlace copiado en el portapapeles!
Before you read the different example NodeNetworkConfigurationPolicy
(NNCP) manifest configurations, consider the following factors when you apply a policy to nodes so that your cluster runs under its best performance conditions:
-
When you need to apply a policy to more than one node, create a
NodeNetworkConfigurationPolicy
manifest for each target node. The Kubernetes NMState Operator applies the policy to each node with a defined NNCP in an unspecified order. Scoping a policy with this approach reduces the length of time for policy application but risks a cluster-wide outage if an error exists in the configuration of the cluster. To avoid this type of error, initially apply an NNCP to some nodes, confirm the NNCP is configured correctly for these nodes, and then proceed with applying the policy to the remaining nodes. -
When you need to apply a policy to many nodes but you only want to create a single NNCP for all the nodes, the Kubernetes NMState Operator applies the policy to each node in sequence. You can set the speed and coverage of policy application for target nodes with the
maxUnavailable
parameter in the cluster’s configuration file. By setting a lower percentage value for the parameter, you can reduce the risk of a cluster-wide outage if the outage impacts the small percentage of nodes that are receiving the policy application. -
If you set the
maxUnavailable
parameter to50%
in two NNCP manifests, the policy configuration coverage applies to 100% of the nodes in your cluster. - When a node restarts, the Kubernetes NMState Operator cannot control the order to which it applies policies to nodes. The Kubernetes NMState Operator might apply interdependent policies in a sequence that results in a degraded network object.
- Consider specifying all related network configurations in a single policy.
1.10.1. Example: Ethernet interface node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
Configure an Ethernet interface on nodes in the cluster by applying a NodeNetworkConfigurationPolicy
manifest to the cluster.
The following YAML file is an example of a manifest for an Ethernet interface. It includes sample values that you must replace with your own information.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses a
hostname
node selector. - 4
- Name of the interface.
- 5
- Optional: Human-readable description of the interface.
- 6
- The type of interface. This example creates an Ethernet networking interface.
- 7
- The requested state for the interface after creation.
- 8
- Optional: If you do not use
dhcp
, you can either set a static IP or leave the interface without an IP address. - 9
- Enables
ipv4
in this example.
1.10.2. Example: Linux bridge interface node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
Create a Linux bridge interface on nodes in the cluster by applying a NodeNetworkConfigurationPolicy
manifest to the cluster.
The following YAML file is an example of a manifest for a Linux bridge interface. It includes samples values that you must replace with your own information.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses a
hostname
node selector. - 4
- Name of the interface.
- 5
- Optional: Human-readable description of the interface.
- 6
- The type of interface. This example creates a bridge.
- 7
- The requested state for the interface after creation.
- 8
- Optional: If you do not use
dhcp
, you can either set a static IP or leave the interface without an IP address. - 9
- Enables
ipv4
in this example. - 10
- Disables
stp
in this example. - 11
- The node NIC to which the bridge attaches.
1.10.3. Example: VLAN interface node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
Create a VLAN interface on nodes in the cluster by applying a NodeNetworkConfigurationPolicy
manifest to the cluster.
Define all related configurations for the VLAN interface of a node in a single NodeNetworkConfigurationPolicy
manifest. For example, define the VLAN interface for a node and the related routes for the VLAN interface in the same NodeNetworkConfigurationPolicy
manifest.
When a node restarts, the Kubernetes NMState Operator cannot control the order in which policies are applied. Therefore, if you use separate policies for related network configurations, the Kubernetes NMState Operator might apply these policies in a sequence that results in a degraded network object.
The following YAML file is an example of a manifest for a VLAN interface. It includes samples values that you must replace with your own information.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses a
hostname
node selector. - 4
- Name of the interface. When deploying on bare metal, only the
<interface_name>.<vlan_number>
VLAN format is supported. - 5
- Optional: Human-readable description of the interface.
- 6
- The type of interface. This example creates a VLAN.
- 7
- The requested state for the interface after creation.
- 8
- The node NIC to which the VLAN is attached.
- 9
- The VLAN tag.
1.10.4. Example: Bond interface node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
Create a bond interface on nodes in the cluster by applying a NodeNetworkConfigurationPolicy
manifest to the cluster.
OpenShift Container Platform only supports the following bond modes:
-
active-backup
-
balance-xor
-
802.3ad
Other bond modes are not supported.
The balance-xor
and 802.3ad
bond modes require switch configuration to establish an "EtherChannel" or similar port grouping. Those two modes also require additional load-balancing configuration, depending on the source and destination of traffic being passed through the interface. The active-backup
bond mode does not require any switch configuration. Other bond modes are not supported.
The following YAML file is an example of a manifest for a bond interface. It includes samples values that you must replace with your own information.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses a
hostname
node selector. - 4
- Name of the interface.
- 5
- Optional: Human-readable description of the interface.
- 6
- The type of interface. This example creates a bond.
- 7
- The requested state for the interface after creation.
- 8
- Optional: If you do not use
dhcp
, you can either set a static IP or leave the interface without an IP address. - 9
- Enables
ipv4
in this example. - 10
- The driver mode for the bond. This example uses
active backup
. - 11
- Optional: This example uses miimon to inspect the bond link every 140ms.
- 12
- The subordinate node NICs in the bond.
- 13
- Optional: The maximum transmission unit (MTU) for the bond. If not specified, this value is set to
1500
by default.
1.10.5. Example: Multiple interfaces in the same node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
You can create multiple interfaces in the same node network configuration policy. These interfaces can reference each other, allowing you to build and deploy a network configuration by using a single policy manifest.
The following example YAML file creates a bond that is named bond10
across two NICs and VLAN that is named bond10.103
that connects to the bond.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example uses
hostname
node selector. - 4 11
- Name of the interface.
- 5 12
- Optional: Human-readable description of the interface.
- 6 13
- The type of interface.
- 7 14
- The requested state for the interface after creation.
- 8
- The driver mode for the bond.
- 9
- Optional: This example uses miimon to inspect the bond link every 140ms.
- 10
- The subordinate node NICs in the bond.
- 15
- The node NIC to which the VLAN is attached.
- 16
- The VLAN tag.
- 17
- Optional: If you do not use dhcp, you can either set a static IP or leave the interface without an IP address.
- 18
- Enables ipv4 in this example.
1.10.6. Example: Node network configuration policy for virtual functions Copiar enlaceEnlace copiado en el portapapeles!
Update host network settings for Single Root I/O Virtualization (SR-IOV) network virtual functions (VF) in an existing cluster by applying a NodeNetworkConfigurationPolicy
manifest.
You can apply a NodeNetworkConfigurationPolicy
manifest to an existing cluster to complete the following tasks:
- Configure QoS host network settings for VFs to optimize performance.
- Add, remove, or update VFs for a network interface.
- Manage VF bonding configurations.
To update host network settings for SR-IOV VFs by using NMState on physical functions that are also managed through the SR-IOV Network Operator, you must set the externallyManaged
parameter in the relevant SriovNetworkNodePolicy
resource to true
. For more information, see the Additional resources section.
The following YAML file is an example of a manifest that defines QoS policies for a VF. This YAML includes samples values that you must replace with your own information.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- This example applies to all nodes with the
worker
role. - 4
- Name of the physical function (PF) network interface.
- 5
- Optional: Human-readable description of the interface.
- 6
- The type of interface.
- 7
- The requested state for the interface after configuration.
- 8
- The total number of VFs.
- 9
- Identifies the VF with an ID of
0
. - 10
- Sets a maximum transmission rate, in Mbps, for the VF. This sample value sets a rate of 200 Mbps.
The following YAML file is an example of a manifest that adds a VF for a network interface.
In this sample configuration, the ens1f1v0
VF is created on the ens1f1
physical interface, and this VF is added to a bonded network interface bond0
. The bond uses active-backup
mode for redundancy. In this example, the VF is configured to use hardware offloading to manage the VLAN directly on the physical interface.
- 1
- Name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. - 3
- The example applies to all nodes with the
worker
role. - 4
- Name of the VF network interface.
- 5
- Number of VFs to create.
- 6
- Setting to allow failover bonding between the active and backup VFs.
- 7
- ID of the VLAN. The example uses hardward offloading to define a VLAN directly on the VF.
- 8
- Name of the bonding network interface.
- 9
- Optional: Human-readable description of the interface.
- 10
- The type of interface.
- 11
- The requested state for the interface after configuration.
- 12
- The bonding policy for the bond.
- 13
- The primary attached bonding port.
- 14
- The ports for the bonded network interface.
- 15
- In this example, the VLAN network interface is added as an additional interface to the bonded network interface.
1.10.7. Example: Network interface with a VRF instance node network configuration policy Copiar enlaceEnlace copiado en el portapapeles!
Associate a Virtual Routing and Forwarding (VRF) instance with a network interface by applying a NodeNetworkConfigurationPolicy
custom resource (CR).
By associating a VRF instance with a network interface, you can support traffic isolation, independent routing decisions, and the logical separation of network resources.
When configuring Virtual Route Forwarding (VRF), you must change the VRF value to a table ID lower than 1000
because a value higher than 1000
is reserved for OpenShift Container Platform.
In a bare-metal environment, you can announce load balancer services through interfaces belonging to a VRF instance by using MetalLB. For more information, see the Additional resources section.
The following YAML file is an example of associating a VRF instance to a network interface. It includes samples values that you must replace with your own information.
1.11. Creating an IP over InfiniBand interface on nodes Copiar enlaceEnlace copiado en el portapapeles!
On the OpenShift Container Platform web console, you can install a Red Hat certified third-party Operator, such as the NVIDIA Network Operator, that supports InfiniBand (IPoIB) mode. Typically, you would use the third-party Operator with other vendor infrastructure to manage resources in an OpenShift Container Platform cluster. To create an IPoIB interface on nodes in your cluster, you must define an InfiniBand (IPoIB) interface in a NodeNetworkConfigurationPolicy
(NNCP) manifest file.
The OpenShift Container Platform documentation describes defining only the IPoIB interface configuration in a NodeNetworkConfigurationPolicy
(NNCP) manifest file. You must refer to the NVIDIA and other third-party vendor documentation for the majority of the configuring steps. Red Hat support does not extend to anything external to the NNCP configuration.
For more information about the NVIDIA Operator, see Getting Started with Red Hat OpenShift (NVIDIA Docs Hub).
Prerequisites
- You installed a Red Hat certified third-party Operator that supports an IPoIB interface.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Create or edit a
NodeNetworkConfigurationPolicy
(NNCP) manifest file, and then specify an IPoIB interface in the file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
datagram
is the default mode for an IPoIB interface, and this mode improves optimizes performance and latency.connected
mode is a supported mode but consider only using this mode when you need to adjust the maximum transmission unit (MTU) value to improve node connectivity with surrounding network devices.- 2
- Supports a string or an integer value. The parameter defines the protection key, or P-key, for the interface for the purposes of authentication and encrypted communications with a third-party vendor, such as NVIDIA. Values
None
and0xffff
indicate the protection key for the base interface in an InfiniBand system. - 3
- Supported values include
name
, the default value, andmac-address
. Thename
value applies a configuration to an interface that holds a specified interface name. - 4
- Holds the MAC address of an interface. For an IP-over-InfiniBand (IPoIB) interface, the address is a 20-byte string.
- 5
- Sets the type of interface to
infiniband
.
Apply the NNCP configuration to each node in your cluster by running the following command. The Kubernetes NMState Operator can then create an IPoIB interface on each node.
$ oc apply -f <nncp_file_name>
$ oc apply -f <nncp_file_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<nncp_file_name>
with the name of your NNCP file.
1.12. Example policy configurations that use dynamic matching and templating Copiar enlaceEnlace copiado en el portapapeles!
The following example configuration snippets show node network policies that use dynamic matching and templating.
Applying node network configuration policies that use dynamic matching and templating is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
1.12.1. Example: Linux bridge interface node network configuration policy to inherit static IP address from the NIC attached to the bridge Copiar enlaceEnlace copiado en el portapapeles!
Create a Linux bridge interface on nodes in the cluster and transfer the static IP configuration of the NIC to the bridge by applying a single NodeNetworkConfigurationPolicy
manifest to the cluster.
The following YAML file is an example of a manifest for a Linux bridge interface. It includes sample values that you must replace with your own information.
- 1
- The name of the policy.
- 2
- Optional: If you do not include the
nodeSelector
parameter, the policy applies to all nodes in the cluster. This example uses thenode-role.kubernetes.io/worker: ""
node selector to select all worker nodes in the cluster. - 3
- The reference to the node NIC to which the bridge attaches.
- 4
- The type of interface. This example creates a bridge.
- 5
- The IP address of the bridge interface. This value matches the IP address of the NIC which is referenced by the
spec.capture.eth1-nic
entry. - 6
- The node NIC to which the bridge attaches.
1.12.2. Example: Node network configuration policy to enable LLDP reporting Copiar enlaceEnlace copiado en el portapapeles!
The following YAML file is an example of a NodeNetworkConfigurationPolicy
manifest that enables the Link Layer Discovery Protocol (LLDP) listener for all ethernet ports in your OpenShift Container Platform cluster. Devices on a local area network can use LLDP to advertise their identity, capabilities, and neighbor information.
1.13. Examples: IP management Copiar enlaceEnlace copiado en el portapapeles!
The following example configuration snippets show different methods of IP management.
These examples use the ethernet
interface type to simplify the example while showing the related context in the policy configuration. These IP management examples can be used with the other interface types.
1.13.1. Static Copiar enlaceEnlace copiado en el portapapeles!
The following snippet statically configures an IP address on the Ethernet interface:
- 1
- Replace this value with the static IP address for the interface.
1.13.2. No IP address Copiar enlaceEnlace copiado en el portapapeles!
The following snippet ensures that the interface has no IP address:
Always set the state
parameter to up
when you set both the ipv4.enabled
and the ipv6.enabled
parameter to false
to disable an interface. If you set state: down
with this configuration, the interface receives a DHCP IP address because of automatic DHCP assignment.
1.13.3. Dynamic host configuration Copiar enlaceEnlace copiado en el portapapeles!
The following snippet configures an Ethernet interface that uses a dynamic IP address, gateway address, and DNS:
The following snippet configures an Ethernet interface that uses a dynamic IP address but does not use a dynamic gateway address or DNS:
1.13.4. Media Access Control (MAC) address Copiar enlaceEnlace copiado en el portapapeles!
You can use a MAC address to identify a network interface instead of using the name of the network interface. A network interface name can change for various reasons, such as an operating system configuration change. However, every network interface has a unique MAC address that does not change. This means that using a MAC address is a more permanent way to identify a specific network interface.
Supported values for the identifier
parameter include the default name
value and the value mac-address
. The name
value applies a configuration to an interface that holds a specified interface name.
Using a mac-address
value for the identifier
parameter indicates that a MAC address is the identifier for the network interface. If you set the identifier
value to mac-address
, you must enter a specific MAC address in the following mac-address
parameter field.
You can still specify a value for the name
parameter, but setting the identifier: mac-address
value means that a MAC address is used as the primary identifier for a network interface. If you specify an incorrect MAC address, nmstate
reports an invalid argument error.
The following snippet specifies a MAC address as the primary identifier for an Ethernet device, named eth1
, with a MAC address of 8A:8C:92:1A:F6:98
:
1.13.5. DNS Copiar enlaceEnlace copiado en el portapapeles!
By default, the nmstate
API stores DNS values globally as against storing them in a network interface. For certain situations, you must configure a network interface to store DNS values.
Setting a DNS configuration is comparable to modifying the /etc/resolv.conf
file.
To define a DNS configuration for a network interface, you must initially specify the dns-resolver
section in the network interface’s YAML configuration file. To apply an NNCP configuration to your network interface, you need to run the oc apply -f <nncp_file_name>
command.
The following example shows a default situation that stores DNS values globally:
Configure a static DNS without a network interface. Note that when updating the
/etc/resolv.conf
file on a host node, you do not need to specify an interface, IPv4 or IPv6, in theNodeNetworkConfigurationPolicy
(NNCP) manifest.Example of a DNS configuration for a network interface that globally stores DNS values
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantYou can specify DNS options under the
dns-resolver.config
section of your NNCP file as demonstrated in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want to remove the DNS options from your network interface, apply the following configuration to your NNCP and then run the
oc apply -f <nncp_file_name>
command:... ...
# ... dns-resolver: config: {} interfaces: [] # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The following examples show situations that require configuring a network interface to store DNS values:
If you want to rank a static DNS name server over a dynamic DNS name server, define the interface that runs either the Dynamic Host Configuration Protocol (DHCP) or the IPv6 Autoconfiguration (
autoconf
) mechanism in the network interface YAML configuration file.Example configuration that adds
192.0.2.1
to DNS name servers retrieved from the DHCPv4 network protocolCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you need to configure a network interface to store DNS values instead of adopting the default method, which uses the
nmstate
API to store DNS values globally, you can set static DNS values and static IP addresses in the network interface YAML file.ImportantStoring DNS values at the network interface level might cause name resolution issues after you attach the interface to network components, such as an Open vSwitch (OVS) bridge, a Linux bridge, or a bond.
Example configuration that stores DNS values at the interface level
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want to set static DNS search domains and static DNS name servers for your network interface, define the static interface that runs either the Dynamic Host Configuration Protocol (DHCP) or the IPv6 Autoconfiguration (
autoconf
) mechanism in the network interface YAML configuration file.ImportantSpecifying the following
dns-resolver
configurations in the network interface YAML file might cause a race condition at reboot that prevents theNodeNetworkConfigurationPolicy
(NNCP) from applying to pods that run in your cluster:- Setting static DNS search domains and dynamic DNS name servers for your network interface.
-
Specifying domain suffixes for the
search
parameter and not setting IP addresses for theserver
parameter.
Example configuration that sets
example.com
andexample.org
static DNS search domains along with static DNS name server settingsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.13.6. Static routing Copiar enlaceEnlace copiado en el portapapeles!
The following snippet configures a static route and a static IP on interface eth1
.
You cannot use the OVN-Kubernetes br-ex
bridge as the next hop interface when configuring a static route unless you manually configured a customized br-ex
bridge.
For more information, see "Creating a manifest object that includes a customized br-ex bridge" in the Deploying installer-provisioned clusters on bare metal document or the Installing a user-provisioned cluster on bare metal document.