All Products
Search
Document Center

Container Service for Kubernetes:Run DPDK applications

Last Updated:Jun 06, 2025

Data Plane Development Kit (DPDK) is a high-performance network data plane development toolkit commonly used in scenarios that require low latency and high throughput. This topic describes how to run DPDK applications in a Container Service for Kubernetes (ACK) cluster.

Step 1: Create a node pool for running DPDK applications

You can create and configure a node pool for running DPDK applications in the console.

1. Configure the container network at the node pool level

DPDK applications must run in Terway elastic network interface (ENI) exclusive mode. For more information about how to configure nodes, see Configure the node network.

2. Configure DPDK dependencies for the node pool

To fully utilize the high-performance advantages of DPDK, you must configure the Virtual Function I/O (VFIO) driver and huge pages before nodes join the cluster or before DPDK applications are started.

  • VFIO driver: allows applications to directly access network interface cards (NICs) to reduce latency.

  • Huge pages: reduces page table switching overhead and improves memory access efficiency for applications.

On the node pool creation or edit page, click Advanced Options (Optional). In the Pre-defined Custom Data section, add the following script to complete the configuration. For more information, see Create and manage a node pool.

# Enable the VFIO driver
rmmod vfio-pci vfio_iommu_type1 vfio || true
modprobe vfio enable_unsafe_noiommu_mode=1
echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
modprobe vfio-pci
# Enable huge pages for nodes
sysctl -w vm.nr_enormouspages=1024
# Restart the kubelet to report huge pages
systemctl restart kubelet

Step 2: Run a DPDK application in a pod

1. Build a DPDK container image

Build a DPDK application by using a Dockerfile. The following example shows the Dockerfile that uses an official DPDK package:

FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3
ARG DPDK_VERSION=21.11.3
# dpdk dependency
RUN yum groupinstall -y 'Development Tools' && yum install -y python3 pciutils iproute && pip3 install meson ninja==v1.8.2 pyelftools
# dpdk build
RUN mkdir dpdk_build && cd dpdk_build && curl -OL http://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz  \
    && tar -xvf dpdk-${DPDK_VERSION}.tar.xz  \
    && cd dpdk-stable-${DPDK_VERSION}  \
    && meson build && cd build && ninja && ninja install

2. Run the DPDK container image in a pod

To run the DPDK container image, you must configure the following key parameters for the pod.

  • Mount the VFIO device: Use a hostPath volume to mount the /dev directory of the host to the /dev directory in the container.

  • Request huge pages memory: Declare the huge pages and memory limits required by the DPDK application in the pod configuration.

  • NIC driver binding: Before the container starts, execute mount -o remount,rw /sys/ && dpdk-devbind.py --force -b vfio-pci eth0 to bind the NIC of the pod to the vfio-pci driver.

The following is an example YAML file for a pod that runs a DPDK application.

apiVersion: v1
kind: Pod
metadata:
  name: dpdk-test
spec:
  containers:
  - args:
    - "-c"
    - "mount -o remount,rw /sys/ && dpdk-devbind.py --force -b vfio-pci eth0 && dpdk-testpmd -- --forward-mode icmpecho"
    command:
    - bash
    tty: true
    image: registry.aliyuncs.com/acs-sample/dpdk-test:21.11.3
    imagePullPolicy: Always
    name: dpdk-test
    resources:
      limits:
        enormouspages-2Mi: 1Gi
        memory: 2Gi
    securityContext:
      privileged: true
    volumeMounts:
    - name: host-dev
      mountPath: /dev
    - mountPath: /enormouspages-2Mi
      name: enormouspage-2mi
  volumes:
  - name: host-dev
    hostPath:
      path: /dev
  - name: enormouspage-2mi
    emptyDir:
      medium: EnormousPages-2Mi