Schedule GPUs with DRA

Updated at:

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.

  1. 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 .

  2. Click Create Node Pool , set the instance type to GPU instance types supported by ACK, and keep the default values for the other parameters.

    1. Click Specify Instance Type and enter the instance type name, such as ecs.gn7i-c8g1.2xlarge. Set Expected Nodes to 1 .

    2. Click Advanced  to expand the node pool editing details. In Node Labels, enter the key-value pair ack.node.gpu.schedule: disabled to 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.

  1. Connect to an ACK cluster using kubectl.

  2. Install the Helm CLI.

    curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
  3. Add the NVIDIA Helm repository and update it.

    helm repo add nvidia https://helm.ngc.nvidia.com/nvidia \
    && helm repo update
  4. Install version 25.3.2 of the NVIDIA DRA GPU driver.

    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=null removes the node affinity declaration of the controller workload and schedules the controller workload 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.

  1. Confirm that the pods of the DRA GPU driver components are in the Running state.

    kubectl get pod -n nvidia-dra-driver-gpu
  2. Confirm that the DRA-related resources are created.

    kubectl get deviceclass,resourceslice

    The 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
  3. View the details of the GPU resources reported in the current environment.

    Replace cn-beijing.1x.1x.3x.1x-gpu.nvidia.com-bnwhj with the name of the actual resourceslice resource 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.
  1. Create the resource-claim-template.yaml file.

    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: gpu

    Create the ResourceClaimTemplate in the cluster.

    kubectl apply -f resource-claim-template.yaml
  2. Create the resource-claim-template-pod.yaml file.

    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-gpu

    Create a workload that references the ResourceClaimTemplate.

    kubectl apply -f resource-claim-template-pod.yaml
  3. View the automatically created ResourceClaim.

    1. Find the ResourceClaim in the current namespace, such as pod1-gpu-wstqm.

      kubectl get resourceclaim
    2. View the details of the ResourceClaim.

      Replace pod1-gpu-wstqm with the name of the actual ResourceClaim resource object.
      kubectl describe resourceclaim pod1-gpu-wstqm
  4. 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 GPU program.

    helm uninstall nvidia-dra-driver-gpu -n nvidia-dra-driver-gpu
  • Remove or release node resources.