Introduction
rdma-agent is a network component provided by Tencent Cloud TKE. It automatically detects RDMA devices available on nodes and registers them with Kubernetes. The component supports RDMA network virtualization and can allocate and bind RDMA devices to Kubernetes Pods, enabling Pods to leverage the high-performance data transfer capabilities of RDMA devices.
Core responsibilities:
1. Device discovery and reporting: Scans RDMA NIC devices on nodes and reports RDMA resources to Kubelet through the Device Plugin mechanism.
2. Device allocation and mounting: When a Pod is created, the system returns a list of RDMA character devices (/dev/infiniband/*) to be mounted. The container runtime then mounts these devices into the Pod and configures cgroup rules to ensure that libraries such as NCCL can access the RDMA devices correctly.
3. RDMA NIC management: Generates and manages RDMA CNI configurations, and manages RDMA Bond NICs in Pods.
Network Architecture
rdma-agent supports two modes: exclusive RDMA NICs and shared RDMA NICs, implementing RDMA network virtualization. Its network architecture is as follows:
Dedicated RDMA NICs
The preceding figure illustrates one node and two Kubernetes Pods. In the figure:
Each node has one primary NIC and eight RDMA Bond NICs.
Each Pod is allocated one standard NIC named eth0, which can access regular VPC networks.
Each Pod is also allocated two RDMA Bond NICs virtualized through MACVLAN. The number of NICs is determined by the number of Bond NICs requested by the Pod and allocated based on NUMA affinity. Each NIC corresponds to one of the node's Bond NICs and reuses the IP address of that node Bond NIC, allowing access to the RDMA interconnect network.
Shared RDMA NICs
The preceding figure illustrates one node and two Kubernetes Pods. In the figure:
Each node has one primary NIC and eight RDMA Bond NICs.
Each Pod is allocated one standard NIC named eth0, which can access regular VPC networks.
Each Pod is also allocated eight RDMA Bond NICs virtualized through IPVLAN. Each NIC corresponds to one of the node's Bond NICs and has an independent IP address, allowing access to the RDMA interconnect network.
Comparison of the Two Modes
|
Resource Model | Physical resources (actual number of bonds) | Virtual resource (1000) |
NIC Usage | Exclusive host bond | Shared host bond |
IP address Allocation | Reuse host bond IP address | The host Bond needs to expand its network segment, and IP addresses are allocated within the segment. |
Device Mounting | Device corresponding to the allocated bond | All RDMA devices |
GID Index | Fixed as Host GID | Dynamic (requires dynamic query by a script in the Pod) |
Topology Awareness | Exclusively occupy some host NICs and allocate them based on NUMA topology awareness. | Share all host NICs, with simple topology. |
Recommended Scenarios | Scenarios where a single Hostnetwork exclusively occupies a host Node; scenarios where a single Pod is allocated 8, 4, 2, or 1 cards (for 2 or 1 cards, PCIE-Switch awareness between GPU and NIC is not guaranteed). | Scenarios with a single or dual card and high requirements for PCI-SWITCH topology awareness; scenarios where multiple Hostnetwork Pods share a host Node. |
Kubernetes Objects Deployed in a Cluster
|
tke-rdma-agent-conf | ConfigMap | - | kube-system |
tke-rdma-shared-agent | DaemonSet | 0.01-core CPU, 100 MB memory | kube-system |
Use Limits
Supports clusters running Kubernetes 1.20 or later.
Deployment is supported only on instances with RDMA devices.
Component Deployment
Pre-checks
Attention:
Ensure that the RDMA netns is in shared mode. Otherwise, the component cannot work properly.
If you use shared RDMA NICs in non-hostnetwork mode, ensure that the Hyper Computing Cluster (THCC) that the RDMA machines join already supports network segments of /28 or larger. 1. Run the following command to check whether the current rdma netns on the node is in shared mode:
/opt/mellanox/iproute2/sbin/rdma system show
The output should be:
2. If the output is exclusive, run the following command to change it to shared:
rm /etc/modprobe.d/ib_core.conf
/opt/mellanox/iproute2/sbin/rdma system set netns shared
If the command fails, restart the node.
3. If you use shared RDMA NICs in non-hostnetwork mode, ensure that the HCC cluster that the RDMA machines join already supports network segments of /28 or larger. Access the meta-data interface on the node to query the network segments supported by the RDMA NICs, and ensure that all intMask values are /28 or larger. Otherwise, IPVLAN network virtualization is not supported, and only HostNetwork can be used.
curl http://169.254.0.23/meta-data/rdma-subnet | grep intMask
Deployment and Installation
1. Log in to the TKE console and select Clusters in the left sidebar. 2. In the cluster list, click the target cluster ID to go to the cluster details page.
3. In the left sidebar, choose Component Management. On the displayed page, click Create.
4. On the Create Component page, select rdma-agent.
6. Click Complete.
Setting Labels on Deployment Nodes
1. On the cluster details page in the TKE console, choose Node Management > Node Pools and click Edit to modify the labels of nodes in the node pool. 2. In the edit parameter settings, add or modify the labels of nodes in the node pool. By default, you must add feature.node.kubernetes.io/tke-shared-rdma=true.
3. After adding or modifying, you can also select "Apply this Label/Annotation/Taint update to existing nodes" to apply the update to existing nodes.
For existing nodes, you can also add a label to the node by running the following command to deploy the rdma-agent component:
# Replace <nodeName> with the name of the existing node. You can query it by running kubectl get node.
kubectl label node <nodeName> feature.node.kubernetes.io/tke-shared-rdma=true
Component Parameter Configuration
|
CpuRequest | CPU required by the component when it is running on each node. Default value: 10m. |
CpuLimit | Maximum CPU occupied by the component when it is running on each node. Default value: 50m. |
MemoryRequest | Memory required by the component when it is running on each node. Default value: 100Mi. |
MemoryLimit | Maximum memory occupied by the component when it is running on each node. Default value: 500Mi. |
KubeletRootDir | Root directory of kubelet on the node where the component runs. Default value: /var/lib/kubelet. If the root directory is changed, update this configuration accordingly. |
NodeSelector | label key-value pair of the node where the component is required to run. The default configuration is feature.node.kubernetes.io/tke-shared-rdma=true. To customize the node label for deployment, modify this configuration. |
Usage