The VKE supports enabling DPDK in pods, suitable for scenarios requiring low latency and high throughput. This topic describes how to deploy and run DPDK apps in a cluster.
DPDK (Data Plane Development Kit) is a high-performance network data plane development toolkit. By using technologies such as userspace polling drivers, huge pages, CPU affinity, and lock-free queues, it bypasses the traditional Linux kernel network stack, significantly reducing overhead from interrupts, context switching, and system calls. This greatly improves packet transfer performance, achieving tens of millions of PPS processing capability on a single CPU core.
In DPDK mode, the host network interface can be assigned to a container to create a direct connection. This allows it to be used as a DPDK high-performance data plane interface. By mounting two network interfaces to a pod, traffic between the data plane and control plane can be physically isolated. This avoids bandwidth contention and latency interference, ensuring stable microsecond-level forwarding.
- The vpc-cni add-on has been installed and upgraded to v1.9.6 or later.
- The VFIO device driver has been enabled on the nodes of the cluster. You can run the following command on the node to check whether the VFIO driver is enabled.
- The expected result is as follows.
- Only supported in clusters using the VPC-CNI network model.
- The number of network interfaces that can be mounted to a node is ≥ 3, meaning it must include at least a primary interface, a secondary interface, and a dedicated interface.
- DPDK can only be enabled on new nodes. We recommend using a dedicated node pool.
Step 1: Enable the DPDK feature
- In the left navigation bar, click Cluster. Click the name of the target cluster to go to the cluster management page.
- In the left navigation bar, select Configurations > ConfigMap.
- In the Namespace drop-down list, select kube-system. Locate cello-config on the page, and click Edit Yaml in the Actions column.
- In the data.conf field, add the exclusiveENIPoolQuota field to enable the DPDK feature on the node.
- The parameter descriptions are shown in the following table.
Note
If you need to modify the above configuration afterwards, please note that the cello pod needs to be restarted for the changes to take effect.
Step 2: Enable DPDK dependencies on the node
Configure manually
Configure via script
You can manually configure the HugePages feature on specified nodes. The procedure is as follows:
- Use ECS Terminal to log in to the target node. For details, see ECS Terminal.
- Run the following command to configure the number of HugePages on the node in the sysctl configuration file.
tip
- This example configures 2Mi HugePages. In practice, adjust the configuration based on your needs.
- Run the following command to restart kubelet.
When creating or editing a node pool, you can use deployment scripts to configure the HugePages feature on nodes in batch. Procedure:
- In the left navigation bar, click Cluster. Click the target cluster name to go to the management page of this cluster.
- In the left navigation bar, select Nodes >Node pool, create a node pool or edit an existing one.
- In the Advanced settings > InitializeScript textbox, paste the following script.
- After completing all the node pool settings, click Confirm to finish the node pool configuration. For descriptions of more node pool parameters, see Creating managed node pools.
After completing the configuration, you can connect to the cluster via kubectl and run the following command to view node information. Here, ${node-ip} is the node IP address, for example, 192.168.1.188. The expected output is as follows, showing the number of HugePages and ENIs that can be allocated or have already been allocated to the node.
Step 3: Use DPDK in the pod
- (Optional) You can use the following Dockerfile example to build a DPDK test image. and install testpmd in the image for testing.
- Create a pod using the above image and configure DPDK. The key settings are as follows:
- Mount VFIO devices: Use a hostPath volume to mount the host's /dev directory to the container's /dev.
- HugePages memory request: Declare the HugePages and memory limits required by the DPDK application in the pod configuration.
- Network interface driver binding: Before the container starts, run mount -o remount,rw /sys/ && dpdk-devbind.py --force -b vfio-pci eth0 to bind the pod's network interface driver to the vfio-pci driver.
- After the configuration is completed, the system will automatically add the annotation k8s.volcengine.com/network-status to the pod, displaying the network interface information mounted to the pod. For example, in this case, the pod has 2 network interfaces mounted, with IP addresses 192.168.1.242 and 192.168.1.244, respectively.
- Run the following command to enter the corresponding pod.
- Run the following command to view the environment variables in the pod.
- The expected output is as follows, where:
- RESOURCE_NAME: Indicates the device name of the PCI device in the pod.
- PCIDEVICE_VOLCENGINE_COM_ENI: Indicates the address (BDF) of the corresponding PCI device.
You can install testpmd in the pod to validate the DPDK feature. For more details, see the official documentation. - Run the following command to view the DPDK version.
- Run the following command to view the DPDK port status.
- The expected output is as follows.
- Run the following command to start testpmd and check whether DPDK is working properly.
- The expected result is as follows, and the log shows that DPDK is working normally.
Subsequent configurations
After the DPDK program exits, run the following command in the pod to manually clear driver_override.