Chapter 9. Using pod-level bonding
Bonding at the pod level is vital to enable workloads inside pods that require high availability and more throughput. With pod-level bonding, you can create a bond interface from multiple single root I/O virtualization (SR-IOV) virtual function interfaces in a kernel mode interface. The SR-IOV virtual functions are passed into the pod and attached to a kernel driver.
One scenario where pod level bonding is required is creating a bond interface from multiple SR-IOV virtual functions on different physical functions. Creating a bond interface from two different physical functions on the host can be used to achieve high availability and throughput at pod level.
Before you perform any tasks in the following documentation, ensure that you installed the SR-IOV Network Operator.
For guidance on tasks such as creating a SR-IOV network, network policies, network attachment definitions and pods, see Configuring an SR-IOV network device.
9.1. Configuring a bond interface from two SR-IOV interfaces
Bonding enables multiple network interfaces to be aggregated into a single logical "bonded" interface. Bond Container Network Interface (Bond-CNI) brings bond capability into containers.
Bond-CNI can be created using Single Root I/O Virtualization (SR-IOV) virtual functions and placing them in the container network namespace.
OpenShift Container Platform only supports Bond-CNI using SR-IOV virtual functions. The SR-IOV Network Operator provides the SR-IOV CNI plugin needed to manage the virtual functions. Other CNIs or types of interfaces are not supported.
Prerequisites
- The SR-IOV Network Operator must be installed and configured to obtain virtual functions in a container.
- To configure SR-IOV interfaces, an SR-IOV network and policy must be created for each interface.
- The SR-IOV Network Operator creates a network attachment definition for each SR-IOV interface, based on the SR-IOV network and policy defined.
- 
						The linkStateis set to the default valueautofor the SR-IOV virtual function.
9.1.1. Creating a bond network attachment definition
Now that the SR-IOV virtual functions are available, you can create a bond network attachment definition.
- 1
- The cni-type is always set tobond.
- 2
- Themodeattribute specifies the bonding mode.NoteThe bonding modes supported are: - 
										balance-rr- 0
- 
										active-backup- 1
- 
										balance-xor- 2
 For balance-rrorbalance-xormodes, you must set thetrustmode toonfor the SR-IOV virtual function.
- 
										
- 3
- Thefailoverattribute is mandatory for active-backup mode and must be set to 1.
- 4
- ThelinksInContainer=trueflag informs the Bond CNI that the required interfaces are to be found inside the container. By default, Bond CNI looks for these interfaces on the host which does not work for integration with SRIOV and Multus.
- 5
- Thelinkssection defines which interfaces will be used to create the bond. By default, Multus names the attached interfaces as: "net", plus a consecutive number, starting with one.
9.1.2. Creating a pod using a bond interface
- Test the setup by creating a pod with a YAML file named for example - podbonding.yamlwith content similar to the following:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Note the network annotation: it contains two SR-IOV network attachments, and one bond network attachment. The bond attachment uses the two SR-IOV interfaces as bonded port interfaces.
 
- Apply the yaml by running the following command: - oc apply -f podbonding.yaml - $ oc apply -f podbonding.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Inspect the pod interfaces with the following command: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow Note- If no interface names are configured in the pod annotation, interface names are assigned automatically as - net<n>, with- <n>starting at- 1.
- Optional: If you want to set a specific interface name for example - bond0, edit the- k8s.v1.cni.cncf.io/networksannotation and set- bond0as the interface name as follows:- annotations: k8s.v1.cni.cncf.io/networks: demo/sriovnet1, demo/sriovnet2, demo/bond-net1@bond0- annotations: k8s.v1.cni.cncf.io/networks: demo/sriovnet1, demo/sriovnet2, demo/bond-net1@bond0- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow