Dynamic resource allocation (DRA) is a declarative resource management mechanism provided by Kubernetes. DRA is designed to address complex resource control challenges in scenarios such as fine-grained allocation, topology-aware scheduling, and cross-node sharing for GPUs and other high-performance hardware. This article details the technical working principles of DRA, its differences from traditional scheduling mechanisms, and relevant configuration methods.
DRA is a Kubernetes resource management framework. In VKE, it allows workloads to request and share hardware resources (such as GPUs and RDMA network interfaces) declaratively. By abstracting hardware resources into programmable API objects, DRA decouples resource management logic from the built-in kubelet logic and migrates it to third-party drivers. DRA significantly enhances resource allocation precision and utilization, particularly in advanced scenarios that require cross-node unified GPU memory addressing, GPU sharing, and high-performance network alignment, delivering greater scheduling flexibility.
Compared with traditional Device Plugin scheduling, DRA differs significantly in resource description and scheduling logic. The following table provides details.
DRA uses resource objects such as ResourceClaims to detect, request, and allocate underlying shared hardware resources. The resource objects involved in this topic are described in the table below.
- Clusters do not support automatic DRA configuration. To use DRA, manually configure it by following the configuration methods described in this topic.
- When nodes in the cluster use DRA, the following GPU features cannot be used:
- You have created a VKE cluster with the Kubernetes version being v1.34 or later.
Step 1: Create a GPU node pool
- In the left navigation bar, click Cluster. In the cluster list, click the name of the target cluster to open the cluster management page.
- In the left navigation bar, click Node pool.
- On the Node pool page, click Create node pool to create a node pool that meets your requirements. For parameter details, see Creating node pools.
- For Instance type, select GPU Accelerated to add nodes with GPUs to the cluster. For specification details, see GPU Accelerated.
- For the Container runtime configuration item, set the containerd version to 2.1 or later.
- In the Advanced settings section, click Add node labels to add the following labels to the node pool.
- Set the label key as vke.node.gpu.schedule and the label value to nvidia-dra. This enables DRA-based GPU scheduling on nodes in this node pool.
- Set the label key to nvidia.com/gpu.present and the label value to true. This indicates that the DRA driver runs on nodes in this node pool.
- Configure other parameters. Then, click Confirm to create the node pool.
Step 2: Install the NVIDIA DRA driver
- Run the following commands to add the NVIDIA Helm repository.
- Run the following command to install the NVIDIA DRA driver. This example shows how to install version 25.8.1 of the driver.
Step 3: Confirm the NVIDIA DRA environment
After you install the NVIDIA DRA driver, check whether it is running normally in the cluster and whether GPU resources have been reported to the cluster.
- Run the following command to check DRA-related API resources in the cluster.
- The expected response is similar to the following one.
- Run the following command to check the information about the NVIDIA DRA Pod.
- The expected response is similar to the following one, which indicates that the Pod has been deployed and is running.
- Run the following command to check the available NVIDIA DRA resources in the cluster.
- The expected response is similar to the following one.
- Run the following command to query the resources reported by NVIDIA DRA nodes.
- The expected response is similar to the following one.
- Run the following command to verify that node resources are correct and that nvidia.com/gpu resources are no longer displayed. In the command, ${dra-node-name} is the node name, for example, 192.168.2.8.
- The expected response is similar to the following one, where Capacity and Allocatable should be empty.
After you have installed the NVIDIA DRA driver in the cluster, you can create a resource claim (ResourceClaim) through the ResourceClaimTemplate resource to enable workloads to request and use GPU resources based on DRA.
Create a ResourceClaimTemplate
- Create a YAML file for the ResourceClaimTemplate. The following resource-claim-template-single-gpu.yaml file serves as an example:
- Run the following command to create the ResourceClaimTemplate.
- Run the following command to check the status of the created ResourceClaimTemplate resource.
- The expected response is similar to the following one.
Deploy workloads that use DRA
- Create a workload that uses the ResourceClaimTemplate to request resources. This example demonstrates how to create a Deployment using the following resource-claim-template-pod.yaml manifest:
- Run the following command to create the workload.
- Run the following command to view the Pod status of the workload.
- If the response is similar to the following one, the workload has been deployed, and its Pod status is Running.
- Run the following command to view the ResourceClaims associated with the workload.
- The expected response is similar to the following one.
- Run the following command to view the details of the ResourceClaim resource.
- The expected response is similar to the following one, including details of devices allocated to the Pod.
- Run the following command to view the Pod logs of the workload.
- The expected response is similar to the following one.