Skip to content

Enable Dynamic Resource Allocation (DRA) in Kubernetes

In the previous blog, we introduced the concept of Dynamic Resource Allocation (DRA) that just went GA in Kubernetes v1.34 which was released in August 2025.

In this blog post, we’ll will configure DRA on a Kubernetes 1.34 cluster.

Info

We have optimized the steps for users to experience this on their macOS or Windows laptops in less than 15 minutes. The steps in this blog are optimized for macOS users.


Kubernetes Cluster using Kind

Kubernetes 1.34 launched just a few days back and the easiest option for users to experience it on their laptops would be with kind.

Assumptions

The following steps assume you have the following installed and functional on your Mac

  1. Docker Desktop
  2. Kubectl CLI utility

Step 1: Install Kind

You can install kind on your Mac using the command below.

brew install kind 

Step 2: Install Kubernetes Cluster

By default, the kind create cluster command will spin up a cluster with Kind’s default Kubernetes version. This can trails slightly behind the latest upstream. So, we will indicate the Kubernetes version.

kind create cluster --name dra-test --image kindest/node:v1.34.0

Kind maintains a list of supported images here. For example:

  • kindest/node:v1.34.0 (latest)
  • kindest/node:v1.32.0
  • kindest/node:v1.28.9

Once your cluster

kubectl version 

As you can see from the output below, we are running Kubernetes v1.34.

Client Version: v1.32.2
Kustomize Version: v5.5.0
Server Version: v1.34.0
WARNING: version difference between client (1.32) and server (1.34) exceeds the supported minor version skew of +/-1

On a new cluster with no DRA driver installed, the output of these commands won't show any resources. Let's verify if that is the case.

kubectl get deviceclasses 
No resources found

Step 3: Install Example DRA Driver

DRA drivers are third-party applications that need to run on each cluster node to interface with the hardware. In this guide, we will use an example DRA driver from the kubernetes-sigs/dra-example-driver repository.

Info

This example driver advertises simulated GPUs to Kubernetes.

Typical Workflow for DRA

flowchart LR
  %% Cluster Admin and Workload Admin for DRA
  classDef step fill:#fff,stroke:#333,stroke-width:1px,rx:12,ry:12,color:#111;
  classDef note fill:#fff,stroke:#333,stroke-width:1px,rx:20,ry:20,color:#111;
  classDef highlightRed fill:#fff,stroke:#f00,stroke-width:2px,rx:12,ry:12,color:#111;

  A[Install DRA drivers<br/>Cluster Admin]:::highlightRed --> B[Create DeviceClasses<br/>Cluster Admin]:::step

  %% Branch
  B --> C[Create ResourceClaim<br/>Workload Admin<br/>Pods share the device]:::step
  B --> D[Create ResourceClaimTemplate<br/>Workload Admin<br/>Pods get separate devices]:::step

  %% Converge
  C --> E([Add claim to Pod requests]):::note
  D --> E

  %% Final step
  E --> F[Deploy workload<br/>Workload Admin]:::step

Step 3.1: Download DRA Driver YAML

Download the DRA Driver YAML file and save it to your laptop with the name "dra-driver.yaml".


Step 3.2: Install DRA Driver

We want to install everything in the namespace called dra-tutorial. So, let's start by creating this namespace first.

kubectl create namespace dra-tutorial 

Now, let us install the example DRA driver using kubectl.

kubectl apply -f dra-driver.yaml --server-side

Let's verify the resources in the namespace using kubectl.

kubectl get po -n dra-tutorial 

You should see something like the following:

NAME                                     READY   STATUS    RESTARTS   AGE
dra-example-driver-kubeletplugin-v8lwj   1/1     Running   0          17s

Step 3.3: Verify DRA Devices

The DRA driver will update the Kubernetes cluster with the devices that are available to pods. It does this by publishing metadata to the ResourceSlices API. Let us now check that API to see that each node with a driver is advertising the device class it represents.

DeviceClass

Notice that the DeviceClass has been set as "gpu.example.com"

kubectl get DeviceClass
NAME              AGE
gpu.example.com   39s

ResouceSlices

Notice that a ResourceSlice has been set.

kubectl get resourceslices
NAME                                           NODE                     DRIVER            POOL                     AGE
dra-test-control-plane-gpu.example.com-dnhl8   dra-test-control-plane   gpu.example.com   dra-test-control-plane   59s

At this stage, you have successfully installed the example DRA driver and verified that it is configured to use DRA to schedule pods.


Step 3.4: State of Simulated GPU Devices

Let us now look at the current state of available GPU devices on the cluster. Type the following command.

kubectl get resourceslice -o yaml

You should see something like the output below. The device plugin (gpu.example.com) created this ResourceSlice to tell Kubernetes the following.

  • The ResourceSlice belongs to the node dra-test-control-plane.
  • The ResourceSlice is a way for a node to advertise available devices/resources to Kubernetes.
  • Workloads requesting resourceclaims can now be allocated these GPUs via DRA.

This node (dra-test-control-plane) has 9 GPUs available, each with 80 GiB memory, managed by my driver.

apiVersion: v1
items:
- apiVersion: resource.k8s.io/v1
  kind: ResourceSlice
  metadata:
    creationTimestamp: "2025-09-16T19:41:45Z"
    generateName: dra-test-control-plane-gpu.example.com-
    generation: 1
    name: dra-test-control-plane-gpu.example.com-wj6cw
    ownerReferences:
    - apiVersion: v1
      controller: true
      kind: Node
      name: dra-test-control-plane
      uid: cced3b6f-cd51-41b1-90ad-8f57429a73b4
    resourceVersion: "765"
    uid: 6b3036ca-a5d9-4c42-8fe6-064578d86218
  spec:
    devices:
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 2
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-1a654c2e-f3fd-3b38-7092-47d1e2cec3b7
      capacity:
        memory:
          value: 80Gi
      name: gpu-2
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 4
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-ce1366d4-d883-5188-8792-7246a8be7207
      capacity:
        memory:
          value: 80Gi
      name: gpu-4
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 7
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-787280ee-4a2d-f587-b838-56ad98374b62
      capacity:
        memory:
          value: 80Gi
      name: gpu-7
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 8
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-a58e2878-bbef-b747-78a4-dd0459651d0f
      capacity:
        memory:
          value: 80Gi
      name: gpu-8
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 0
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-6fdb2b2a-317b-7567-901e-4fd527d642d9
      capacity:
        memory:
          value: 80Gi
      name: gpu-0
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 1
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-0821c150-0f52-922a-cfc7-d2b230c459ab
      capacity:
        memory:
          value: 80Gi
      name: gpu-1
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 3
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-537835b5-0875-11c4-b6b8-2adf5bf8f4c3
      capacity:
        memory:
          value: 80Gi
      name: gpu-3
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 5
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-7c8413eb-c4a7-b759-9f32-367a17074901
      capacity:
        memory:
          value: 80Gi
      name: gpu-5
    - attributes:
        driverVersion:
          version: 1.0.0
        index:
          int: 6
        model:
          string: LATEST-GPU-MODEL
        uuid:
          string: gpu-0f1ea05b-65f4-232c-01d0-ff56897960b3
      capacity:
        memory:
          value: 80Gi
      name: gpu-6
    driver: gpu.example.com
    nodeName: dra-test-control-plane
    pool:
      generation: 1
      name: dra-test-control-plane
      resourceSliceCount: 1
kind: List
metadata:
  resourceVersion: ""

Clean Up

We recommend leaving the Kind cluster as is for the next blog. But, if you wish to clean up everything, you can delete the Kind cluster we provisioned earlier by issuing the following command.

kind delete cluster --name dra-test 

Conclusion

In this blog, we installed a Kubernetes v1.34 cluster, installed and configured a DRA driver on it with simulated GPUs. In the next blog, we will deploy a few example workloads that will demonstrate how ResourceClaims and ResourceClaimTemplates can be used to select and configure GPU resources using DRA.