Schedule GPUs with DRA
In AI training and inference scenarios where multiple applications share GPUs, deploy the NVIDIA DRA driver in an ACK cluster to overcome the scheduling limits of traditional device plugins. The Kubernetes DRA API allocates GPUs dynamically across pods with fine-grained control, improving GPU utilization and reducing costs.
How it works
-
Dynamic Resource Allocation (DRA) enables you to request and share GPU resources across pods. DRA is an extension of the persistent volumes API to general-purpose resources. Compared with the traditional device plugin model, DRA provides a more flexible and fine-grained way to request resources.
-
NVIDIA Dynamic Resource Allocation GPU driver (NVIDIA DRA Driver for GPUs) implements the DRA API to provide Kubernetes workloads with a modern way of allocating GPUs. The driver supports controlled GPU sharing and dynamic GPU reconfiguration.
Applicable scope
Create an ACK managed cluster. The cluster must run Kubernetes 1.34 or later.
Configure the DRA GPU scheduling environment
Step 1: Create a GPU node pool
Create a node pool that uses DRA GPU scheduling, and use a node label to disable the default GPU Device Plugin resource reporting so that GPU devices are not allocated more than once.
-
Log on to the ACK console. In the left-side navigation pane, choose Clusters . Click the name of the cluster that you want to manage , and then choose Nodes > Node Pools .
-
Click Create Node Pool , set the instance type to GPU instance types supported by ACK, and keep the default values for the other parameters.
-
Click Specify Instance Type and enter the instance type name, such as
ecs.gn7i-c8g1.2xlarge. Set Expected Nodes to 1 . -
Click Advanced to expand the node pool editing details. In Node Labels, enter the key-value pair
ack.node.gpu.schedule: disabledto disable the default exclusive GPU scheduling feature and stop GPU Device Plugin resource reporting.Enabling both Device Plugin and DRA causes GPU resources to be allocated more than once. Therefore, you must disable GPU Device Plugin resource reporting on DRA nodes.
-
Step 2: Install the NVIDIA DRA driver
Install the NVIDIA DRA GPU driver to provide the cluster with the concrete implementation of the DRA API.
-
Install the Helm CLI.
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash -
Add the
NVIDIA Helmrepository and update it.helm repo add nvidia https://helm.ngc.nvidia.com/nvidia \ && helm repo update -
Install version
25.3.2of theNVIDIA DRA GPUdriver.helm install nvidia-dra-driver-gpu nvidia/nvidia-dra-driver-gpu --version="25.3.2" --create-namespace --namespace nvidia-dra-driver-gpu \ --set gpuResourcesEnabledOverride=true \ --set controller.affinity=null \ --set "kubeletPlugin.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key=ack.node.gpu.schedule" \ --set "kubeletPlugin.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].operator=In" \ --set "kubeletPlugin.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].values[0]=disabled"Important--set controller.affinity=nullremoves the node affinity declaration of thecontrollerworkload and schedules thecontrollerworkload on any node. This may cause stability issues. In a production environment, evaluate the impact before you perform this operation.The following output indicates that the driver is installed correctly:
NAME: nvidia-dra-driver-gpu LAST DEPLOYED: Tue Oct 14 20:42:13 2025 NAMESPACE: nvidia-dra-driver-gpu STATUS: deployed REVISION: 1 TEST SUITE: None
Step 3: Verify the environment configuration
Verify that the NVIDIA DRA driver is running properly, and confirm that GPU resources are reported to the Kubernetes cluster.
-
Confirm that the pods of the DRA GPU driver components are in the
Runningstate.kubectl get pod -n nvidia-dra-driver-gpu -
Confirm that the DRA-related resources are created.
kubectl get deviceclass,resourcesliceThe expected output is:
NAME AGE deviceclass.resource.k8s.io/compute-domain-daemon.nvidia.com 60s deviceclass.resource.k8s.io/compute-domain-default-channel.nvidia.com 60s deviceclass.resource.k8s.io/gpu.nvidia.com 60s deviceclass.resource.k8s.io/mig.nvidia.com 60s NAME NODE DRIVER POOL AGE resourceslice.resource.k8s.io/cn-beijing.1x.1x.3x.1x-compute-domain.nvidia.com-htjqn cn-beijing.10.11.34.156 compute-domain.nvidia.com cn-beijing.10.11.34.156 57s resourceslice.resource.k8s.io/cn-beijing.1x.1x.3x.1x-gpu.nvidia.com-bnwhj cn-beijing.10.11.34.156 gpu.nvidia.com cn-beijing.10.11.34.156 57s -
View the details of the GPU resources reported in the current environment.
Replace
cn-beijing.1x.1x.3x.1x-gpu.nvidia.com-bnwhjwith the name of the actualresourcesliceresource object.kubectl get resourceslice.resource.k8s.io/cn-beijing.1x.1x.3x.1x-gpu.nvidia.com-bnwhj -o yaml
Deploy a workload that uses DRA GPUs
After the environment configuration is complete, the following example shows how to use a ResourceClaimTemplate to automatically create ResourceClaims, so that a workload can request and use DRA GPU resources.
-
Create the
resource-claim-template.yamlfile.apiVersion: resource.k8s.io/v1 kind: ResourceClaimTemplate metadata: name: single-gpu spec: spec: devices: requests: - exactly: allocationMode: ExactCount deviceClassName: gpu.nvidia.com count: 1 name: gpuCreate the
ResourceClaimTemplatein the cluster.kubectl apply -f resource-claim-template.yaml -
Create the
resource-claim-template-pod.yamlfile.apiVersion: v1 kind: Pod metadata: name: pod1 labels: app: pod spec: containers: - name: ctr image: registry-cn-hangzhou.ack.aliyuncs.com/dev/ubuntu:22.04 command: ["bash", "-c"] args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"] resources: claims: - name: gpu resourceClaims: - name: gpu resourceClaimTemplateName: single-gpuCreate a workload that references the
ResourceClaimTemplate.kubectl apply -f resource-claim-template-pod.yaml -
View the automatically created
ResourceClaim.-
Find the
ResourceClaimin the current namespace, such aspod1-gpu-wstqm.kubectl get resourceclaim -
View the details of the
ResourceClaim.Replace
pod1-gpu-wstqmwith the name of the actualResourceClaimresource object.kubectl describe resourceclaim pod1-gpu-wstqm
-
-
Check whether the workload uses the GPU properly. The expected output is
GPU 0: NVIDIA A10.kubectl logs pod1
(Optional) Clean up the environment
After the test is complete, if you no longer need the created resources, clean them up promptly to avoid unnecessary costs.
-
Delete the deployed workloads and ResourceClaims to clean up the environment.
kubectl delete pod pod1 kubectl delete resourceclaimtemplate single-gpu -
Delete the created
NVIDIA DRA GPUprogram.helm uninstall nvidia-dra-driver-gpu -n nvidia-dra-driver-gpu