Kubernetes DRA for GPU Workloads

8 min read
KubernetesDRAGPUGKEAI InfrastructureScheduling

For years, scheduling GPUs and specialized accelerators on Kubernetes meant relying on the Device Plugin framework. While device plugins work well for simple integer counts such as requesting one whole GPU per container, they break down quickly when AI teams need fine-grained hardware selection, multi-container device sharing, or per-workload driver configuration.

Dynamic Resource Allocation (DRA) solves these limitations natively in the Kubernetes control plane. With core APIs in the resource.k8s.io/v1 group graduating to General Availability in Kubernetes v1.34 and becoming locked-on in v1.35, DRA is now the standard way to manage GPUs, TPUs, and high-speed interconnects across modern clusters, including Google Kubernetes Engine (GKE). If you are planning your broader Kubernetes AI infrastructure stack, DRA is one of the most impactful scheduling upgrades to adopt.

Why Device Plugins Fall Short for AI and GPU Workloads

Under the legacy Device Plugin model, kubelet advertises accelerators as opaque extended resources such as nvidia.com/gpu: 2. The scheduler only sees an integer count and cannot inspect device attributes like VRAM capacity, interconnect topology, or driver capabilities without relying on coarse node labels.

As a result, platform teams often end up maintaining dozens of fragmented node pools and forcing application developers to hardcode nodeSelector or nodeAffinity rules in every Pod spec. Sharing a single GPU across sidecar and main containers, or passing workload-specific initialization parameters, is either unsupported or requires fragile vendor workarounds.

  • No native attribute filtering: Workloads cannot express requirements like minimum 64 GiB GPU memory without custom node labels.
  • No cross-container sharing: Extended resources are allocated exclusively to a single container.
  • Node-wide configuration: Tuning MIG profiles or driver settings typically applies to an entire node rather than individual workloads.
  • Opaque scheduling: Kube-scheduler lacks visibility into device-level constraints during filtering and scoring.

Core DRA Architecture and API Objects

DRA borrows its mental model from dynamic volume provisioning, where StorageClass and PersistentVolumeClaim decouple storage consumers from underlying hardware. In DRA, four primary objects in resource.k8s.io/v1 coordinate hardware discovery, classification, and allocation:

  • ResourceSlice: Published by a DRA kubelet plugin (driver) to advertise available devices on a node along with their attributes and capacities.
  • DeviceClass: Created by cluster admins or driver vendors to define reusable hardware categories with Common Expression Language (CEL) selectors.
  • ResourceClaim: Represents a specific request for one or more devices, either standalone (for sharing across Pods) or generated per Pod.
  • ResourceClaimTemplate: A blueprint referenced by Deployments, Jobs, or StatefulSets so each Pod automatically receives its own ResourceClaim.

Because DRA uses structured parameters, kube-scheduler evaluates ResourceSlices and CEL expressions directly in-memory during scheduling. Once a node is selected, the vendor DRA driver prepares the device and attaches it to the container runtime using the Container Device Interface (CDI).

Defining a DeviceClass and ResourceClaimTemplate

In practice, platform engineers define DeviceClass objects to expose curated hardware tiers—such as a cost-optimized tier for inference and a high-memory tier for training. Workload operators then request devices through a ResourceClaimTemplate without needing to know which node pools host which GPUs.

gpu-resource-claim-template.yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaimTemplate
metadata:
  name: h100-64g-template
  namespace: ai-workloads
spec:
  spec:
    devices:
      requests:
      - name: gpu-claim
        exactly:
          deviceClassName: nvidia-gpu
          selectors:
          - cel:
              expression: |-
                device.attributes["gpu.nvidia.com"].productName.contains("H100") &&
                device.capacity["gpu.nvidia.com"].memory >= quantity("64Gi")

Notice how the CEL expression filters directly on device attributes and capacity published in ResourceSlices. This eliminates manual node pinning and lets the scheduler place the Pod on any node that satisfies the hardware requirement.

Sharing a Single GPU Across Containers with ResourceClaim

When multiple containers in the same Pod—or multiple Pods in a coordinated job—need access to the exact same allocated device, you create a named ResourceClaim instead of a template and reference it from each container's resources.claims list.

shared-gpu-job.yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  name: shared-gpu-claim
  namespace: ai-workloads
spec:
  devices:
    requests:
    - name: single-gpu
      exactly:
        deviceClassName: nvidia-gpu
        allocationMode: ExactCount
        count: 1
---
apiVersion: batch/v1
kind: Job
metadata:
  name: inference-with-profiler
  namespace: ai-workloads
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
      - name: model-server
        image: nvcr.io/nvidia/tritonserver:24.08-py3
        resources:
          claims:
          - name: shared-gpu
      - name: gpu-sidecar
        image: ubuntu:24.04
        command: ["sleep", "3600"]
        resources:
          claims:
          - name: shared-gpu
      resourceClaims:
      - name: shared-gpu
        resourceClaimName: shared-gpu-claim

In this pattern, both model-server and gpu-sidecar attach to the same physical GPU via CDI. This is especially useful for telemetry sidecars, model-loading init containers, and co-located inference pipelines.

Advanced Scheduling Features in Kubernetes 1.34+

Beyond basic device claims, recent Kubernetes releases added production-critical capabilities that make DRA practical for large multi-tenant clusters:

  • Prioritized alternatives (firstAvailable): Workloads can list fallback hardware options in preference order—for example, requesting one high-end GPU first and falling back to two mid-tier GPUs if the primary option is unavailable.
  • Admin access isolation: The resource.k8s.io/admin-access: "true" namespace label restricts privileged adminAccess claims so regular tenants cannot inspect or attach to devices owned by other workloads.
  • PodResources API integration: Kubelet reports DRA-allocated devices through the PodResources API, allowing node monitoring agents to track per-Pod accelerator usage.
  • NVIDIA ComputeDomains: With the Kubernetes SIGs dra-driver-nvidia-gpu driver, teams can dynamically provision isolated Multi-Node NVLink (MNNVL) domains bound to a workload's lifecycle.

Running DRA on Google Kubernetes Engine (GKE)

Google Cloud supports DRA in GKE for both GPUs and Cloud TPUs. When planning your cluster architecture—especially when weighing GKE Autopilot vs Standard—keep in mind how driver management differs between modes.

On GKE Standard clusters, platform administrators disable automatic legacy GPU device-plugin installation on dedicated DRA node pools and deploy the vendor DRA driver (such as the NVIDIA GPU DRA driver) so ResourceSlices are populated cleanly without conflicting allocations. Combined with event-driven workload scaling covered in our Kubernetes autoscaling guide, DRA helps maximize expensive accelerator utilization.

Operational Limitations and Adoption Checklist

Before migrating production GPU pools to DRA, verify two key operational constraints. First, the Kubernetes scheduler does not currently support preemption for DRA resources: a higher-priority Pod waiting for a DRA-managed GPU will remain Pending until the running Pod holding that claim terminates. Second, always verify your cluster version and vendor DRA driver compatibility before retiring legacy device plugins.

  1. Run Kubernetes v1.34 or newer so resource.k8s.io/v1 is enabled by default without beta feature gates.
  2. Audit your GPU and TPU workloads to separate exclusive training jobs from shareable inference or profiling workloads.
  3. Deploy the vendor DRA driver on a dedicated pilot node pool with legacy device plugins disabled to avoid double-accounting.
  4. Define standardized DeviceClass objects with clear CEL filters and enforce admin-access namespace labels for multi-tenant safety.

/ author

Pawel Bedynski

DevOps Engineer & Kubernetes Consultant. Building cloud-native infrastructure on GCP since 2019. 80+ production clusters deployed.

LinkedIn