Enable OVS with DPDK

OVS with DPDK

OVS WorkerNode Prerequisites

  1. Bare-metal nodes as worker nodes.
  2. Hugepages to be enabled on worker nodes.

Hugepage Support

Enable hugepages by performing following steps:

  • Update the /etc/default/grub file on the worker nodes with following properties:

GRUB_CMDLINE_LINUX='console=tty0 console=ttyS1,115200n8 intel_iommu=on iommu=pt default_hugepagesz=1G hugepagesz=1G hugepages=10'

GRUB_SERIAL_COMMAND='serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1'

  • Update Grub
Bash
Copy
  • Update vm.nr_hugepages in /etc/sysctl.conf and refresh kernel parameters.
Bash
Copy
  • Reboot the worker nodes
Bash
Copy
  • Confirm that hugepages are configured.
Bash
Copy
Bash
Copy
  • Mount the hugepages, if not already mounted by default.
Bash
Copy

Setting up OVS-DPDK with Pf9 DHCP Server on a PMK cluster

Create a PMK Cluster with the configured worker nodes in the previous section.

PMK cluster should have the following add-ons enabled:

  • KubeVirt Add-on
  • Advanced Networking Operator (Luigi) Add-on

1. Create Network Plugins Custom Resource

Network Plugin customer resource used to install advanced networking plugins such as ovs, sriov, dpdk, etc. and their configuration.

YAML
Copy

Dpdk configuration parameters:

  • lcoremask : Specifies the CPU cores on which dpdk lcore threads should be spawned and expects hex string
  • socketMem : Comma separated list of memory to pre-allocate from hugepages on specific sockets
  • pmdCpuMask : The pmd-cpu-mask is a core bitmask that sets which cores are used by OVS-DPDK for datapath packet processing.
  • hugepageMemory : (no. of hugepages*hugepagesize) : The amount of memory for hugepages. For example, in the above yaml it indicates that 2Gi hugepage-backed RAM will be used for ovs-dpdk pod. huge page size is 1Gi it would allocate 2 hugepage.
    • Note: hugepageMemory needs to be greater than or equal to socket mem. if socketmem: “1024,1024“ then hugepageMemory >= 2Gi

DHCP controller plugin

DHCP controller plugin enables running PF9 DHCP server inside pod/virtual machine to cater to the DHCP requests from virtual machine instance(not pod in case of Kubevirt). Multus network-attachment-definitions will use DHCP server to assign IPs. Pf9 DHCP server serves as an alternate to the IPAM CNIs (whereabouts, host-local), which are used as delegate from backend CNI, which gets managed/triggered at pod creation and pod deletion.

Refer for more information: https://platform9.com/docs/kubernetes/enable-p9-dhcp

2. Create Host Network Template

Host Network Template is used to define configuration such as ovs-config etc. on the PMK cluster.

YAML
Copy

ovsCofig parameters:

  • bridgeName : User Defined name of the OVS bridge
  • nodeInterface : Physical Network interface to be used to create ovs-bridge with.
  • dpdk: Boolean to enable dpdk on hosts.

3. Create Network Attachment Definition

Network Attachment Definition is a Multus CRD used to configure additional NIC on pods and virtual machines.

Bash
Copy

4. Create Pf9 DHCP server

Bash
Copy

About the fields:

  • Name: Name of the DHCPServer. Configurations of dnsmasq will be generated in a Configmap with the same name
  • networks: list of all networks that this pod will serve:
    • networkName: Name of NetworkAttachmentDefinition to provide IPs for. NAD should not have dhcp plugin enabled.
    • interfaceIp: IP address that the pod will be allocated. Must have prefix to ensure proper routes are added.
    • leaseDuration: Duration the leases offered should be valid for. Provide in valid formats for dnsmasq (eg: 10m, 5h, etc). Defaults to 1h
    • vlanId: Dnsmasq network identifier. Used as an identifier while restoring IPs. Optional.
    • cidr: range_start, range_end, gateway are optional. range is compulsory. If range start and end are provided, they will be used in place of the default start and end.

At this point the PMK cluster is ready to be used for workloads such as Pods and Virtual Machines.

Create a sample Virtual Machines to use the nad-ovs-dpdk-dhcp network.

Let’s validate your work by creating a Virtual Machine to consume the nad-ovs-dpdk-dhcp network.

Bash
Copy

Validate the VM

Bash
Copy

Validate the VMI

Note that the VMI is annotated with the IP from PF9 DHCP server :

dhcp.plumber.k8s.pf9.io/dhcpserver: '{"02:55:43:00:00:49":"192.168.15.72"}'

Bash
Copy

Variations of OVS networks

OVS networks can be configured using the HostNetworkTemplate Custom Resource

OVS network without DPDK

YAML
Copy

OVS Bonded network without DPDK

YAML
Copy

OVS Bonded network with DPDK

YAML
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated