|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/k8s_nmstate/k8s-nmstate-updating-node-network-config.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: REFERENCE |
| 6 | +[id="virt-example-vf-host-services_{context}"] |
| 7 | += Example: Node network configuration policy for virtual functions (Technology Preview) |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +:FeatureName: Updating host network settings for SR-IOV network VFs |
| 12 | +include::snippets/technology-preview.adoc[leveloffset=+1] |
| 13 | + |
| 14 | +You can apply a `NodeNetworkConfigurationPolicy` manifest to an existing cluster to complete the following tasks: |
| 15 | + |
| 16 | +* Configure QoS or MTU host network settings for VFs to optimize performance. |
| 17 | +* Add, remove, or update VFs for a network interface. |
| 18 | +* Manage VF bonding configurations. |
| 19 | +
|
| 20 | +[NOTE] |
| 21 | +==== |
| 22 | +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. |
| 23 | +==== |
| 24 | + |
| 25 | +The following YAML file is an example of a manifest that defines QoS policies for a VF. |
| 26 | +This file includes samples values that you must replace with your own information. |
| 27 | + |
| 28 | +[source,yaml] |
| 29 | +---- |
| 30 | +apiVersion: nmstate.io/v1 |
| 31 | +kind: NodeNetworkConfigurationPolicy |
| 32 | +metadata: |
| 33 | + name: qos <1> |
| 34 | +spec: |
| 35 | + nodeSelector: <2> |
| 36 | + node-role.kubernetes.io/worker: "" <3> |
| 37 | + desiredState: |
| 38 | + interfaces: |
| 39 | + - name: ens1f0 <4> |
| 40 | + description: Change QOS on VF0 <5> |
| 41 | + type: ethernet <6> |
| 42 | + state: up <7> |
| 43 | + ethernet: |
| 44 | + sr-iov: |
| 45 | + total-vfs: 3 <8> |
| 46 | + vfs: |
| 47 | + - id: 0 <9> |
| 48 | + max-tx-rate: 200 <10> |
| 49 | +---- |
| 50 | + |
| 51 | +<1> Name of the policy. |
| 52 | +<2> Optional: If you do not include the `nodeSelector` parameter, the policy applies to all nodes in the cluster. |
| 53 | +<3> This example applies to all nodes with the `worker` role. |
| 54 | +<4> Name of the physical function (PF) network interface. |
| 55 | +<5> Optional: Human-readable description of the interface. |
| 56 | +<6> The type of interface. |
| 57 | +<7> The requested state for the interface after configuration. |
| 58 | +<8> The total number of VFs. |
| 59 | +<9> Identifies the VF with an ID of `0`. |
| 60 | +<10> Sets a maximum transmission rate, in Mbps, for the VF. This sample value sets a rate of 200 Mbps. |
| 61 | + |
| 62 | +The following YAML file is an example of a manifest that creates a VLAN interface on top of a VF and adds it to a bonded network interface. |
| 63 | +It includes samples values that you must replace with your own information. |
| 64 | + |
| 65 | +[source,yaml] |
| 66 | +---- |
| 67 | +
|
| 68 | +apiVersion: nmstate.io/v1 |
| 69 | +kind: NodeNetworkConfigurationPolicy |
| 70 | +metadata: |
| 71 | + name: addvf <1> |
| 72 | +spec: |
| 73 | + nodeSelector: <2> |
| 74 | + node-role.kubernetes.io/worker: "" <3> |
| 75 | + maxUnavailable: 3 |
| 76 | + desiredState: |
| 77 | + interfaces: |
| 78 | + - name: ens1f0v1 <4> |
| 79 | + type: ethernet |
| 80 | + state: up |
| 81 | + - name: ens1f0v1.477 <5> |
| 82 | + type: vlan |
| 83 | + state: up |
| 84 | + vlan: |
| 85 | + base-iface: ens1f0v1 <6> |
| 86 | + id: 477 |
| 87 | + - name: bond0 <7> |
| 88 | + description: Add vf <8> |
| 89 | + type: bond <9> |
| 90 | + state: up <10> |
| 91 | + link-aggregation: |
| 92 | + mode: active-backup <11> |
| 93 | + options: |
| 94 | + primary: ens1f1v0.477 <12> |
| 95 | + port: <13> |
| 96 | + - ens1f1v0.477 |
| 97 | + - ens1f0v0.477 |
| 98 | + - ens1f0v1.477 <14> |
| 99 | +---- |
| 100 | +<1> Name of the policy. |
| 101 | +<2> Optional: If you do not include the `nodeSelector` parameter, the policy applies to all nodes in the cluster. |
| 102 | +<3> This example applies to all nodes with the `worker` role. |
| 103 | +<4> Name of the VF network interface. |
| 104 | +<5> Name of the VLAN network interface. |
| 105 | +<6> The VF network interface to which the VLAN interface is attached. |
| 106 | +<7> Name of the bonding network interface. |
| 107 | +<8> Optional: Human-readable description of the interface. |
| 108 | +<9> The type of interface. |
| 109 | +<10> The requested state for the interface after configuration. |
| 110 | +<11> The bonding policy for the bond. |
| 111 | +<12> The primary attached bonding port. |
| 112 | +<13> The ports for the bonded network interface. |
| 113 | +<14> In this example, this VLAN network interface is added as an additional interface to the bonded network interface. |
0 commit comments