Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 4. Using the SR-IOV Network Operator
When you run network-intensive workloads on MicroShift, you need a simplified and declarative method to configure and access high-performance networking interfaces. You can optionally install the SR-IOV Network Operator so that you can expose SR-IOV devices as resources and use NetworkAttachmentDefinitions to access Virtual Functions (VFs).
4.1. Understanding the SR-IOV Network Operator Link kopierenLink in die Zwischenablage kopiert!
SR-IOV (Single Root I/O Virtualization) is a specification that allows a single physical Peripheral Component Interconnect Express (PCIe) device that supports SR-IOV, for example, a Physical Function (PF), to appear as multiple separate physical devices known as Virtual Functions (VFs). You can directly assign VFs to pods, which bypasses the host operating system network stack, improves throughput, and reduces latency for network intensive workloads.
The integration of the SR-IOV Network Operator and CNI provider into MicroShift enables declarative access to VFs. As a result, you can expose supported SR-IOV devices as specialized resources within your MicroShift pod for more predictable high-speed networking for demanding workloads. The deployed SR-IOV resources operate in the sriov-network-operator namespace.
You do not need to manually configure SR-IOV through the operating system. You can also treat VFs as resources that can be reliably mapped to your containerized applications. These resources reduce manual error and ensure consistent, low-latency networking for critical applications.
Here are the components of SR-IOV functionality:
- SR-IOV Network Operator: The SR-IOV Network Operator is a Kubernetes component that detects and manages SR-IOV devices. This component exposes the SR-IOV devices as schedulable resources within MicroShift.
- SR-IOV CNI Provider: This Container Network Interface (CNI) provider works with Multus to assign the exposed VFs to the application pods.
- Virtual Functions (VFs): VFs are lightweight PCIe functions exposed by the PF that are assigned to pods.
- NetworkAttachment Definitions: NetworkAttachmentDefinitions are custom resources (CRs) that are used to define the specific network configuration so that application developers can specify the VFs they need access. NetworkAttachmentDefinitions provide the declarative method for accessing VFs.
4.2. Installing the SR-IOV Network Operator Link kopierenLink in die Zwischenablage kopiert!
Install the necessary SR-IOV components to enable MicroShift to discover SR-IOV devices and expose them as resources for scheduling.
Prerequisites
- You have the required RPM package containing the SR-IOV Network Operator.
Procedure
-
If provided as an optional RPM, install the required
microshift-sriovRPM package. -
Restart the MicroShift service to deploy the SR-IOV resources in the
sriov-network-operatornamespace. To specify the required VF configuration based on the available hardware, create an
SriovNetworkNodePolicycustom resource (CR). For example, save the following YAML as the filepolicyoneflag-sriov-node-network.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
metadata.nameparameter specifies the name for the custom resource object. -
The
metadata.namespaceparameter specifies the namespace where the SR-IOV Network Operator is installed. -
The
spec.resourceNameparameter specifies the resource name of the SR-IOV network device plugin. You can create multiple SR-IOV network node policies for a resource name. -
(Optional) The
spec.priorityparameter specifies a priority value. The priority is an integer value between0and99. A smaller value receives higher priority. For example, a priority of10is a higher priority than99. The default value is99. -
The
spec.numVfsparameter specifies the number of the virtual functions (VFs) to create for the SR-IOV physical network device. For an Intel network interface controller (NIC), the number of VFs cannot be larger than the total VFs supported by the device. For a Mellanox NIC, the number of VFs cannot be larger than127. -
The
spec.nicSelectorparameter identifies the device for the Operator to configure. You do not have to specify values for all the parameters. It is recommended to identify the network device with enough precision to avoid selecting a device unintentionally. If you specifyrootDevices, you must also specify a value forvendor,deviceID, orpfNames. If you specify bothpfNamesandrootDevicesat the same time, ensure that they refer to the same device. If you specify a value fornetFilter, then you do not need to specify any other parameter because a network ID is unique. -
(Optional) The
spec.nicSelector.pfNamesparameter specifies an array of one or more physical function (PF) names for the device. -
(Optional) The
spec.deviceTypeparameter specifies the driver type for the virtual functions. The only allowed value isnetdevice. (Optional) The
spec.isRDMAparameter configures whether to enable remote direct memory access (RDMA) mode. The default value isfalse. If thespec.isRdmaparameter is set totrue, you can continue to use the RDMA-enabled VF as a normal network device. A device can be used in either mode. to configure a Mellanox NIC for use with Fast Datapath DPDK applications, setspec.isRdmatotrueand additionally set theneedVhostNetparameter totrueNoteThe
vfio-pcidriver type is not supported.
-
The
Create the
SriovNetworkNodePolicyobject by entering the following command:oc create -f policyoneflag-sriov-node-network.yaml
$ oc create -f policyoneflag-sriov-node-network.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow After applying the configuration update, the workload contains the required resources and dependencies for VF access.
To verify that the SR-IOV network device is configured, enter the following command. Replace
<node_name>with the name of a node with the SR-IOV network device that you just configured. Expected output showsSucceeded.oc get sriovnetworknodestates -n sriov-network-operator <node_name> -o jsonpath='{.status.syncStatus}'$ oc get sriovnetworknodestates -n sriov-network-operator <node_name> -o jsonpath='{.status.syncStatus}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy an
SriovNetworkcustom resource (CR) which references theSriovNetworkNodePolicyCR and insert themetaPluginsconfiguration, as in the following example CR. The Operator generates aNetworkAttachmentDefinitionCR and the VFs become available to the pods. Save the YAML as the filesriov-network-interface-sysctl.yaml.Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
metadata.nameparameter specifies the name for the object. The SR-IOV Network Operator creates aNetworkAttachmentDefinitionobject with the same name. -
The
metadata.namespaceparameter specifies the namespace where the SR-IOV Network Operator is installed. -
The
spec.resourceNameparameter displays the value from theSriovNetworkNodePolicyobject that defines the SR-IOV hardware for this additional network. -
The
spec.networkNamespaceparameter specifies the target namespace for theSriovNetworkobject. Only pods in the target namespace can attach to the additional network. -
The
spec.ipamparameter specifies a configuration object for the IPAM CNI plugin as a YAML block scalar. The plugin manages IP address assignment for the attachment definition. -
(Optional) The
spec.capabilitiesparameter sets capabilities for the additional network. You can specify"{ "ips": true }"to enable IP address support or"{ "mac": true }"to enable MAC address support. -
(Optional) The
spec.metaPluginsparameter is used to add additional capabilities to the device. In this use case set thetypefield totuning. Specify the interface-level networksysctlyou want to set in thesysctlfield.
-
The
Create the
SriovNetworkresource by entering the following command:oc create -f sriov-network-interface-sysctl.yaml
$ oc create -f sriov-network-interface-sysctl.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Confirm that the SR-IOV Network Operator created the
NetworkAttachmentDefinitionCR by running the following command:oc get network-attachment-definitions -n <namespace>
$ oc get network-attachment-definitions -n <namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<namespace>with the value fornetworkNamespaceparameter that you specified in theSriovNetworkobject, for example,sysctl-tuning-test. The expected output shows the name of the NAD CRD and the creation age in minutes.NoteThere might be a delay before the SR-IOV Network Operator creates the CR.
Verify that the tuning CNI is correctly configured and the additional SR-IOV network is attached:
Create a
PodCR. Save the following YAML as the fileexamplepod.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
annotations.nameparameter specifies the name of the SR-IOV network attachment definition CR. -
(Optional) The
annotations.macparameter specifies the MAC address for the SR-IOV device that is allocated from the resource type defined in the SR-IOV network attachment definition CR. To use this feature, you also must specify{ "mac": true }in theSriovNetworkobject. -
(Optional) The
annotations.ipsparameter specifies the IP addresses for the SR-IOV device that are allocated from the resource type defined in the SR-IOV network attachment definition CR. Both IPv4 and IPv6 addresses are supported. To use this feature, you also must specify{ "ips": true }in theSriovNetworkobject.
-
The
Create the
PodCR by entering the following command:oc apply -f examplepod.yaml
$ oc apply -f examplepod.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the pod is created by running the following command:
oc get pod -n sysctl-tuning-test
$ oc get pod -n sysctl-tuning-testCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
NAME READY STATUS RESTARTS AGE tunepod 1/1 Running 0 47s
NAME READY STATUS RESTARTS AGE tunepod 1/1 Running 0 47sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Log in to the pod by running the following command:
oc rsh -n sysctl-tuning-test tunepod
$ oc rsh -n sysctl-tuning-test tunepodCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the values of the configured sysctl flag. Find the value
net.ipv4.conf.IFNAME.accept_redirectsby running the following command:sysctl net.ipv4.conf.net1.accept_redirects
$ sysctl net.ipv4.conf.net1.accept_redirectsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3. SR-IOV Network Operator supported devices Link kopierenLink in die Zwischenablage kopiert!
SR-IOV Network Operator configuration file
The config.yaml file lists the supported network devices for the SR-IOV Network Operator.
For the most up-to-date list of supported cards and compatible Red Hat build of MicroShift versions available, see Openshift Single Root I/O Virtualization (SR-IOV) and PTP hardware networks Support Matrix.