1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-example-vf-host-services.adoc

112 lines
4.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/k8s_nmstate/k8s-nmstate-updating-node-network-config.adoc
:_mod-docs-content-type: REFERENCE
[id="virt-example-vf-host-services_{context}"]
= Example: Node network configuration policy for virtual functions
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.
[NOTE]
====
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.
[source,yaml]
----
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: qos <1>
spec:
nodeSelector: <2>
node-role.kubernetes.io/worker: "" <3>
desiredState:
interfaces:
- name: ens1f0 <4>
description: Change QOS on VF0 <5>
type: ethernet <6>
state: up <7>
ethernet:
sr-iov:
total-vfs: 3 <8>
vfs:
- id: 0 <9>
max-tx-rate: 200 <10>
----
<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.
[source,yaml]
----
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: addvf <1>
spec:
nodeSelector: <2>
node-role.kubernetes.io/worker: "" <3>
maxUnavailable: 3
desiredState:
interfaces:
- name: ens1f1 <4>
type: ethernet
state: up
ethernet:
sr-iov:
total-vfs: 1 <5>
vfs:
- id: 0
trust: true <6>
vlan-id: 477 <7>
- name: bond0 <8>
description: Attach VFs to bond <9>
type: bond <10>
state: up <11>
link-aggregation:
mode: active-backup <12>
options:
primary: ens1f0v0 <13>
port: <14>
- ens1f0v0
- ens1f1v0 <15>
----
<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.