Use eRDMA to accelerate container networks in ACK clusters

Updated at:

Elastic RDMA (eRDMA) is a low-latency, high-throughput, and highly elastic high-performance RDMA network service provided by Alibaba Cloud. Use eRDMA in ACK clusters to enable RDMA networking in pods for NCCL (NVIDIA Collective Communications Library) distributed training or SMC-R (Shared Memory Communications over RDMA) transparent TCP acceleration.

Add eRDMA-capable nodes to the cluster, install the ACK eRDMA Controller, and enable eRDMA acceleration in pods.

Prerequisites

Ensure you have:

  • An ACK cluster running Kubernetes 1.20 or later for CPU nodes, or 1.26 or later for GPU nodes. Upgrade a cluster if needed.

  • Nodes with Elastic RDMA Interface (ERI) support are added to a node pool. eRDMA is supported only on some instance types. See Enable eRDMA on enterprise-level instances for the supported instance types.

  • Nodes run Alibaba Cloud Linux 3 (all versions), Alibaba Cloud Linux 4 (all versions), or Ubuntu 24.04 for CPU nodes, or, for GPU nodes, an image with the eRDMA driver pre-installed selected from Marketplace Image, such as Alibaba Cloud Linux 3 64-bit (pre-installed with the eRDMA software stack). Custom images based on these images are also supported.

How it works

eRDMA is built on the fourth-generation Shenlong architecture and uses VPC networks in the cloud. eRDMA is 100% compatible with the RDMA ecosystem and provides an inclusive RDMA service on ECS for ultra-large-scale network deployments.

The ACK eRDMA Controller manages eRDMA-capable elastic network interfaces (ENIs) on cluster nodes. It registers eRDMA devices as the aliyun/erdma extended resource, configures ENI routes, and exposes devices to pods through Kubernetes resource requests.

Pods request eRDMA access by declaring aliyun/erdma in their resource limits. To also accelerate TCP connections without code changes, enable SMC-R through a pod annotation.

Building block

Role

ACK eRDMA Controller

Registers eRDMA devices as extended resources; manages ENI routes

eRDMA driver (default / compat / ofed)

Kernel-level driver installed on each node

aliyun/erdma resource

Kubernetes extended resource for pod device access

SMC-R

Linux protocol that transparently replaces TCP with RDMA transport

Step 1: Add eRDMA-capable nodes to the cluster

New nodes

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click the name of your cluster. In the left navigation pane, click Nodes > Node Pools.

  3. Follow Create and manage node pools to create nodes in a node pool. The instance types of the new nodes must support eRDMA (see Prerequisites), and you must select one of the following images or a custom image based on one of them:

    1. CPU nodes:

      1. Alibaba Cloud Linux 3 (all versions)

      2. Alibaba Cloud Linux 4 (all versions)

      3. Ubuntu 24.04

    2. GPU nodes: select an image with the eRDMA driver pre-installed from Marketplace Image, for example:

      1. Alibaba Cloud Linux 3 64-bit (pre-installed with the eRDMA software stack)

Existing nodes

If you have ECS instances that support eRDMA, you can add them to the ACK cluster.

Important

GPU nodes must have the eRDMA driver installed before they can be added to the cluster. Install the driver in one of the following ways:

  • Pre-installed through an OS image (recommended): the node uses an Alibaba Cloud OS image with the eRDMA software stack pre-installed, for example Alibaba Cloud Linux 3 64-bit (pre-installed with the eRDMA software stack) in Marketplace Image.

  • Manual installation: follow Enable eRDMA on GPU instances to install the eRDMA software stack on the instance. After the node joins the cluster, confirm that the eRDMA driver and NIC configurations are normal.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click the name of your cluster. In the left navigation pane, click Nodes > Node Pools.

  3. Follow Add existing nodes to add the nodes to a node pool. The instance types of the existing nodes must support eRDMA (see Prerequisites).

Step 2: Install the ACK eRDMA Controller

Note

If your cluster uses the Terway network plugin, configure a whitelist for ENIs to prevent Terway from modifying eRDMA-capable ENIs.

  1. On the Clusters page, click your cluster name, then click Add-ons.

  2. On the Add-ons page, click the Network tab. Find and install ACK eRDMA Controller with the following settings:

    Note

    When a node has multiple NICs, the ACK eRDMA Controller assigns eRDMA ENI routes a lower priority than same-CIDR NIC routes. The default priority is 200. If you need to configure NIC routes manually after installing the ACK eRDMA Controller, avoid route conflicts.

    Setting

    Description

    preferDriver (driver type)

    Select the eRDMA driver mode to use on the node. default: the default driver mode. compat : RoCE-compatible environments, including out-of-band (OOB) link establishment. ofed: OFED driver mode, suitable for GPU instance types. See Enable eRDMA.

    Specifies whether to assign all eRDMA devices of nodes to pods

    True (selected): allocates all eRDMA devices on the node to the pod. False (cleared): allocates one eRDMA device to the pod based on the NUMA topology. False (cleared) requires the CPU Static Policy on the node to keep pods and devices pinned to the same NUMA node. See Create and manage node pools.

  3. Go to Workloads > Pods, set the namespace to ack-erdma-controller, and confirm all pods are running.

Step 3: Enable eRDMA in pods

Add the following configurations to your pod spec to enable eRDMA acceleration.

Enable eRDMA device access

Declare the aliyun/erdma resource in the container's resource limits:

spec:
  containers:
  - name: erdma-container
    resources:
      limits:
        aliyun/erdma: 1

After the pod starts, verify eRDMA devices are available:

/# ls /dev/infiniband/
rdma_cm  uverbs0
When preferDriver is set to ofed (for GPU instances), the pod's /dev/infiniband/ directory may not contain the rdma_cm device and may show only devices such as uverbs0. This is expected because communication frameworks such as NCCL in GPU scenarios do not depend on rdma_cm, and eRDMA acceleration is not affected.

Enable transparent TCP acceleration with SMC-R

SMC-R transparently accelerates TCP connections over RDMA without code changes. After enabling eRDMA device access, add the following annotation:

metadata:
  annotations:
    network.alibabacloud.com/erdma-smcr: "true"
Note
  • Both ends of the TCP connection must have SMC-R enabled.

  • SMC-R is supported only on Alibaba Cloud Linux 3 with kernel version 5.10.134-17 or later. See Alibaba Cloud Linux 3 image release notes.

  • SMC-R is not supported with preferDriver set to ofed or compat.

  • eRDMA and SMC-R do not support IPv6. SMC-R falls back to TCP for IPv6 connections.

Use cases

Accelerate NCCL communication for GPU distributed training

Use this scenario for GPU-accelerated instances running distributed training. Pods use the ofed driver and request GPU and eRDMA resources.

  1. Install the ACK eRDMA Controller with preferDriver set to ofed .

  2. Add GPU nodes to the node pool. GPU nodes must have the eRDMA driver installed before they can join the cluster: use an image with the eRDMA software stack pre-installed (recommended), such as Alibaba Cloud Linux 3 64-bit (pre-installed with the eRDMA software stack) selected from Marketplace Image , or install the driver manually as described in Enable eRDMA on GPU instances , then confirm the eRDMA driver and NIC configuration after the node joins. See Create and manage node pools.

  3. Install eRDMA packages in the container image at build time. For Debian or Ubuntu (replace {OS|ubuntu} and {Version|focal} with your values):

    wget -qO - https://mirrors.aliyun.com/erdma/GPGKEY | apt-key add - \
      && echo "deb [ arch=amd64 ] https://mirrors.aliyun.com/erdma/apt/{OS|ubuntu} {Version|focal}/erdma main" \
        | tee /etc/apt/sources.list.d/erdma.list \
      && apt update \
      && apt install -y libibverbs1 ibverbs-providers ibverbs-utils librdmacm1

    For Alibaba Cloud Linux or RHEL, use the repository directory that matches your operating system:

    cat > /etc/yum.repos.d/erdma.repo <<EOF
    [erdma]
    name = ERDMA Repository
    baseurl = http://mirrors.aliyun.com/erdma/yum/redhat/7/erdma/x86_64/
    gpgcheck = 0
    enabled = 1
    EOF
    yum install --disablerepo=* --enablerepo erdma -y libibverbs ibverbs-providers ibverbs-utils librdmacm
  4. Deploy the GPU application. This StatefulSet runs nccl-test across two replicas, each with 8 GPUs and one eRDMA device:

    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: nccltest
    spec:
      selector:
        matchLabels:
          app: nccltest
      serviceName: "nccltest"
      replicas: 2
      template:
        metadata:
          labels:
            app: nccltest
        spec:
          hostNetwork: true
          dnsPolicy: ClusterFirstWithHostNet
          containers:
          - env:
            - name: NCCL_SOCKET_IFNAME
              value: "eth0"
            - name: NCCL_DEBUG
              value: "INFO"
            - name: NCCL_IB_GID_INDEX
              value: "1"
            image: <nccl-test-image-with-erdma>
            imagePullPolicy: Always
            name: nccltest
            securityContext:
              capabilities:
                add:
                - SYS_RESOURCE
                - IPC_LOCK
            resources:
              limits:
                nvidia.com/gpu: "8"
                aliyun/erdma: "1"
              requests:
                nvidia.com/gpu: "8"
                aliyun/erdma: "1"
  5. Verify NCCL is using eRDMA. The logs should show erdma_0 and erdma_1 as active, confirming eRDMA acceleration.

    image

Accelerate application networks transparently with SMC-R

Use this scenario for standard TCP workloads that need eRDMA acceleration without code changes. Set preferDriver to default.

  1. Install the ACK eRDMA Controller with preferDriver set to default.

  2. Deploy the application with the SMC-R annotation. This Deployment enables eRDMA device access and SMC-R acceleration:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: app-with-erdma
      name: app-with-erdma
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: app-with-erdma
      template:
        metadata:
          labels:
            app: app-with-erdma
          annotations:
            network.alibabacloud.com/erdma-smcr: "true"
        spec:
          containers:
          - image: <application image>
            imagePullPolicy: Always
            name: app-with-erdma
            resources:
              limits:
                aliyun/erdma: 1
  3. Verify acceleration. Install smc-tools in the container and run smcss:

    /# smcss
    State          UID   Inode   Local Address           Peer Address            Intf Mode
    ACTIVE         00000 0059964 172.17.192.73:47772     172.17.192.10:80        0000 SMCR

    SMCR in the Mode column confirms eRDMA acceleration is active. If it shows TCP, verify both client and server pods have the SMC-R annotation set to "true".

Next steps