Dynamic Resource Allocation

Quota management and topology-aware placement for workloads using Kubernetes Dynamic Resource Allocation (DRA).

Dynamic Resource Allocation

Dynamic Resource Allocation (DRA) is a Kubernetes API for requesting and managing hardware devices such as GPUs, FPGAs, and network adapters. Kueue can account for DRA devices in quota management through two paths:

  1. ResourceClaimTemplate path: Pods explicitly reference a ResourceClaimTemplate that specifies a device request. Kueue maps each DeviceClass referenced by the claim to a logical resource name using deviceClassMappings in the Kueue Configuration.

  2. Extended resource path: Pods request DRA devices using the traditional resources.requests syntax (e.g., nvidia.com/gpu: 1). When the Kubernetes DeviceClass has an extendedResourceName field set (KEP-5004), the kube-scheduler automatically creates ResourceClaim objects from these requests. Kueue detects this and avoids double counting.

Which path should I use? If your workloads already use resources.requests for devices (e.g., nvidia.com/gpu: 1), use the extended resource path. If your workloads explicitly create ResourceClaimTemplate objects, use the ResourceClaimTemplate path.

How the ResourceClaimTemplate path works

Feature state beta since Kueue v0.18

When a Pod references a ResourceClaimTemplate, Kueue reads the deviceClassName from the template’s exactly field and looks it up in deviceClassMappings. With KueueDRAIntegrationPrioritizedList enabled it reads a request’s firstAvailable alternatives as well; see the limitations below for what that charges. A request for an excluded DeviceClass is skipped instead. This mapping tells Kueue which logical resource name to charge quota against. The number of units charged is determined by the count field in the device request (default 1).

Only the ExactCount allocation mode is supported. The All allocation mode is not supported, except for an excluded DeviceClass.

For setup instructions, see Set Up Dynamic Resource Allocation. For firstAvailable requests, see Set up firstAvailable requests and Using a firstAvailable request.

How the extended resource path works

Feature state beta since Kueue v0.19

When a Pod requests an extended resource backed by DRA (e.g., nvidia.com/gpu: 1), the kube-scheduler auto-creates a ResourceClaim. Kueue detects the matching DeviceClass, uses extendedResourceName as the quota key, and drops the auto-created claim from accounting. This prevents quota from being charged for both the resources.requests entry and the auto-created claim, which would double count the same device. No deviceClassMappings configuration is needed; the mapping is discovered from the DeviceClass automatically. A deviceClassMappings entry covering that DeviceClass moves the charge to the mapping’s logical name.

This behavior is controlled by the KueueDRAIntegrationExtendedResource feature gate, which is enabled by default since v0.19.

Path separation

The two paths are independent:

  • ResourceClaimTemplate path: uses deviceClassMappings configuration.
  • Extended resource path: uses auto-discovery from DeviceClass objects.

Do not configure the same DeviceClass in both paths for the same workload. If overlap occurs, Kueue merges the resources using the deviceClassMappings logical name as the quota key, which may result in incorrect quota accounting.

Excluded DeviceClasses

Feature state alpha since Kueue v0.21

Some Pods take companion devices next to their accelerators, such as every RDMA NIC on a node with allocationMode: All, while the accelerators are charged another way, for example as nvidia.com/gpu. List the companion DeviceClass names in excludeDeviceClassNames and Kueue skips them:

  • Kueue charges no quota for a request on a listed class, whatever its allocation mode.
  • Kueue does not reject the request for allocationMode: All or for a missing mapping.
  • A listed class must still exist. While it is missing, Kueue does not admit the Workload, as for any other class.
  • Kueue skips the ResourceSlice CEL check for the request, but still compiles its CEL selectors.
  • Kueue skips a firstAvailable request when every alternative names a listed class. A request that mixes listed and other classes is rejected.
  • Kueue charges no quota for an extended resource backed by a listed class either, while KueueDRAIntegrationExtendedResource is enabled. Only the containers’ requests drop out. A Pod overhead under that name, or the output of a resource transformation that reads it, is still charged, as for a mapped class. Kueue decides this per resource name, so it also applies on nodes where a device plugin advertises that name.

List only devices that need no quota. A GPU class listed by mistake escapes quota. Check a class’s extendedResourceName before you list it. If the class backs an extended resource, containers’ requests for that name go uncharged on every node. A listed class must not appear in deviceClassMappings.

This requires the KueueDRAExcludeDeviceClasses feature gate, which is alpha and off by default. Do not use it in production yet.

With Topology-Aware Scheduling with DRA, the per-node check still simulates the claims on listed classes. So TAS picks nodes with those devices free. A request with allocationMode: All takes every matching device on the node, so TAS places no more such Pods on a node than its devices can take. This does not hold in two cases:

  • The topology does not have kubernetes.io/hostname as its lowest level. Kueue then does not know the node of an admitted workload’s Pods, so another workload can be placed on that node until those Pods are bound.
  • The ClusterQueue uses the scheduler library’s assignment planner, which the SchedulerLibraryDeepIntegration feature gate allows. The check does not run.

In those cases, make a Pod with such a request fill its node, for example with a CPU or memory request.

With MultiKueue, the manager and the workers need the same list, because the manager charges quota too. If the manager lists a class that a worker does not, that worker can reject its copy. The manager’s admission check then stays Pending without a reason, unless another worker admits the Workload. For extended resources, the listed DeviceClass must also exist on the manager.

For setup instructions, see Exclude DeviceClasses from quota.

Quota accounting

DRA resources are tracked in ClusterQueue quotas just like CPU or memory. The administrator includes the DRA resource name in coveredResources and sets a nominalQuota. Kueue supports three quota accounting modes:

  • Device count (default): Charges the count value from the device request (default 1 when omitted). A ClusterQueue with example.com/gpu: 8 allows up to 8 concurrent device allocations.
  • Counter-based: Charges the device’s consumesCounters value (e.g., GPU memory). See Counter-based quota.
  • Capacity-based: Charges the workload’s capacity.requests value rounded per the device’s RequestPolicy. See Capacity-based quota.

Admission and scheduling gap

There is a timing gap between Kueue admitting a workload (quota check) and the kube-scheduler allocating the actual device. Kueue does not know which specific device will be allocated — it only verifies that quota is available.

If the cluster state changes between these two steps (e.g., another system consumes the device), the scheduler may fail to allocate. The WaitForPodsReady feature provides a safety net by evicting workloads that fail to become ready within a configured timeout.

With Topology-Aware Scheduling, Kueue can also check before admission that a node has the devices a Pod needs. See Topology-Aware Scheduling with DRA.

Topology-Aware Scheduling with DRA

Feature state alpha since Kueue v0.20

KueueDRADeviceFeasibility adds a device check to Topology-Aware Scheduling (TAS): TAS places each Pod only on nodes that can allocate the devices it requests. Quota limits how many devices a ClusterQueue admits, not where they are, and without this feature TAS cannot tell which nodes have them. What goes wrong depends on how a Pod requests its devices:

  • ResourceClaimTemplate path: the devices are not in the Pod’s resource requests, so TAS places the Pod by its other resources alone. For example, a ClusterQueue with a quota of 8 GPUs on two nodes with 4 GPUs each admits a Pod whose ResourceClaimTemplate requests 6 GPUs: the quota allows it, but no node has 6. The Pod stays Pending while the workload holds the quota.
  • Extended resource path: the Pod requests a resource such as example.com/gpu, and TAS looks for it in each node’s allocatable, where a resource that only a DeviceClass provides never appears, so the workload fits on no node; see the warning in When the check runs.

How the device check works

  1. A workload is assigned a flavor with a topologyName (a TAS flavor).

  2. Because a Pod’s ResourceClaim objects do not exist before admission, Kueue builds the claims each Pod will need: from its ResourceClaimTemplates, or from the DeviceClass for an extended resource. For every node that the flavor and the Pod’s other scheduling constraints allow, Kueue tries to allocate these claims, using the same allocator as the kube-scheduler.

  3. Nodes where the allocation fails are dropped. On the remaining nodes, Kueue counts how many of the PodSet’s Pods the devices can take, and TAS places no more Pods on a node than that count. For an extended resource, the check replaces TAS’s lookup in node allocatable, except on nodes that advertise the resource through a device plugin. TAS applies this count with any topology, including one whose lowest level is not kubernetes.io/hostname. The cases above, where it does not hold for an admitted workload, still apply.

  4. When no node is left, the workload stays pending, and its QuotaReserved condition message counts the nodes rejected for devices as draNoFit:

    couldn't assign flavors to pod set main: topology "dra-topology" doesn't allow to fit any of 1 pod(s). Total nodes: 2; excluded: draNoFit: 2
    
  5. Kueue checks the workload again when a ResourceSlice or DeviceClass changes, or when a ResourceClaim releases its devices.

Kueue treats a device as taken when an allocated ResourceClaim holds it, when an earlier PodSet group of the same workload takes it, when an admitted workload’s Pod will get it but the kube-scheduler has not bound the Pod yet, and when a workload admitted earlier in the same scheduling cycle takes it. The last two need a topology whose lowest level is kubernetes.io/hostname, because otherwise Kueue does not know the node of each Pod. When Kueue evaluates preemption, the devices of the workloads it would preempt count as free. This does not hold for every job type, see Limitations of the check. A workload that preemption only shrinks keeps all its devices. When the preempted Pods hold allocated ResourceClaims, the preempting workload is admitted after the ResourceClaim controller deallocates them. When they hold none yet, it can be admitted once the preempted workloads are evicted. Keep the TASResidualPodAccounting feature gate enabled, as it is by default. With it disabled, Kueue does not wait for the ResourceClaim controller to deallocate them, and it can preempt more workloads than it needs.

When the check runs

WorkloadDevice check
Assigned a flavor with a topologyName, on the ResourceClaimTemplate or extended resource pathRuns
Assigned a flavor without a topologyNameDoes not run
In a ClusterQueue with a MultiKueue admission checkRuns on the worker cluster, where topology is assigned, not on the manager
In a ClusterQueue with a ProvisioningRequest admission checkSkipped on the first scheduling pass, which assigns no topology; runs on the second pass, after quota is reserved

Prerequisites

  • A Topology and a ResourceFlavor with topologyName, as described in Setup Topology-Aware Scheduling.
  • A DRA driver that publishes each node’s devices in ResourceSlice objects.
  • The KueueDRADeviceFeasibility feature gate enabled in Kueue Configuration. The gates it requires are enabled by default; if one of them is disabled, Kueue does not start and logs conflicting feature gates detected.

Device taints

Feature state alpha since Kueue v0.20

With this gate, the check skips devices with a NoSchedule or NoExecute device taint that the request does not tolerate, whether a DRA driver publishes the taint in a ResourceSlice or an administrator applies it with a DeviceTaintRule. None taints are ignored. A change to a DeviceTaintRule makes Kueue check rejected workloads again.

Kueue reads DeviceTaintRule objects only from Kubernetes 1.37 onwards, which serves them as resource.k8s.io/v1; on earlier versions it ignores taints from rules. With this gate disabled, it ignores all device taints. In both cases Kueue can admit a workload onto tainted devices that the kube-scheduler then refuses, so enable this gate together with KueueDRADeviceFeasibility.

Limitations of the check

  • Preempting a workload whose Pods have another owner frees no devices: Kueue frees the devices of a preempted workload only when its Pods and the workload have the same owner. For example, a child Job or a RayCluster owns the Pods of a JobSet, a TrainJob or a RayJob. So a preemptor that needs their devices stays pending.
  • Kubernetes DRA feature gates are read from the Kueue process: the check follows the gates of the Kubernetes version Kueue is built with, Kubernetes 1.37 for Kueue v0.20, not the cluster’s. This matters only when objects carry the fields of a DRA feature that the kube-scheduler has disabled, for example when the feature is disabled on the kube-scheduler but not on the kube-apiserver, or disabled after objects already used it. Otherwise the kube-apiserver drops the fields of a disabled feature, so Kueue and the kube-scheduler see the same devices.
  • Allocation time is not bounded: each check tries allocations on every node, up to the PodSet’s Pod count. A slow DeviceClass CEL selector makes every scheduling cycle slower, rather than timing out.
  • The kube-scheduler picks its own devices: Kueue takes devices for an admitted workload’s Pods before they are bound, but the kube-scheduler can pick other devices on that node. A later Pod that needs a device Kueue counted free then stays Pending until that device is freed, or until waitForPodsReady evicts its workload.
  • Not run by the scheduler library’s planner: with the SchedulerLibraryDeepIntegration alpha feature gate enabled, a ClusterQueue that uses that planner places workloads without the device check.
  • Not every Kubernetes DRA feature is modeled: some, such as DRADeviceBindingConditions, change what the kube-scheduler does but not what the check predicts (full list).

For setup instructions, see Use Topology-Aware Scheduling with DRA.

MultiKueue

DRA workloads are supported with MultiKueue. MultiKueue syncs the workload and its owning job to worker clusters, but ResourceClaimTemplate and DeviceClass objects are not automatically synced. These must be created on each worker cluster separately by the cluster administrator.

Counter-based quota for partitionable devices

Feature state beta since Kueue v0.19

By default, Kueue tracks DRA quota by device count: each device request charges count units regardless of the device’s capacity. This means a small GPU partition and a full GPU both count as “1 device”, which does not reflect the actual resource consumption.

Kueue can track quota using counter values published by DRA drivers in ResourceSlice objects. This allows quota to reflect actual device capacity (e.g., GPU memory) rather than device count.

This behavior is controlled by the KueueDRAIntegrationPartitionableDevices feature gate, which is enabled by default since v0.19.

A DeviceClass uses either device-count quota (no sources configured) or counter-based quota (with sources), not both. Kueue rejects configurations that map the same DeviceClass to multiple resource names.

How it works

  1. The administrator configures a sources entry in deviceClassMappings that specifies which counter to track, which DRA driver to query, and a CEL expression to scope eligible devices.

  2. When a workload is submitted, Kueue reads the consumesCounters field from the matching devices in ResourceSlice objects to determine the actual counter charge.

  3. Kueue uses conservative charging: it takes the maximum consumesCounters value across all matched devices and multiplies by the request count. This ensures quota is not undercharged when different devices consume different amounts.

  4. The ClusterQueue quota is set in counter units (e.g., 800Gi for GPU memory) instead of device count.

Prerequisites

  • Kubernetes 1.35 or later with the DRAPartitionableDevices feature gate enabled (beta in Kubernetes 1.36).
  • A DRA driver that publishes consumesCounters on devices in ResourceSlice objects.

For setup instructions, see Set Up Dynamic Resource Allocation.

Counter-based vs capacity-based quota

Both modes track quota by actual resource consumption rather than device count, but they serve different device types:

Counter-based (PD)Capacity-based (CC)
Device typePartitioned devices (e.g., NVIDIA MIG)Shared devices (e.g., GPU time-slicing, MPS)
Charge sourceDevice’s consumesCountersWorkload’s capacity.requests
Who decides consumptionDriver (fixed per partition)User (variable per workload)
Upstream K8s featureKEP-4815 (DRAPartitionableDevices)KEP-5075 (DRAConsumableCapacity)

If your GPUs use hardware partitioning (MIG), use counter-based quota. If your GPUs allow software-level sharing where workloads request variable amounts of capacity, use capacity-based quota.

A cluster can use both modes simultaneously with different DeviceClasses using the same DRA driver. One DeviceClass with counter sources for partitioned devices and another with capacity sources for shared devices. Counter and capacity sources cannot be mixed within the same DeviceClass mapping.

Capacity-based quota for shared devices (consumable capacity)

Feature state beta since Kueue v0.21

Some devices allow multiple workloads to share them simultaneously using software-level sharing mechanisms such as GPU time-slicing or MPS. These devices publish a Capacity field on each device in ResourceSlice objects (defined by KEP-5075) instead of using consumesCounters. Workloads specify how much capacity they need via capacity.requests on the device request.

Kueue can track quota using these capacity dimensions so that the total consumed capacity across all sharing workloads does not exceed the device’s published capacity.

This behavior is controlled by the KueueDRAIntegrationConsumableCapacity feature gate, which is enabled by default since v0.21.

A DeviceClass uses either device-count quota (no sources), counter-based quota (with counter sources), or capacity-based quota (with capacity sources). Counter and capacity sources cannot be mixed in the same mapping.

How it works

  1. The administrator configures a capacity source entry in deviceClassMappings that specifies which capacity dimension to track, which DRA driver to query, and a CEL expression to scope eligible devices.

  2. When a workload is submitted, Kueue reads the workload’s capacity.requests from the ExactDeviceRequest for the configured dimension. If capacity.requests is omitted, Kueue uses the device’s RequestPolicy.Default or the full Capacity.Value as the charge.

  3. Kueue rounds the request per the device’s RequestPolicy (ValidValues or ValidRange with Step) to prevent quota gaming where a small request consumes more actual capacity after rounding by the kube-scheduler. The rounded charge appears in the Workload’s status.resourceRequests after a failed admission attempt, and in status.admission once admitted.

  4. For each matched device, Kueue computes the charge independently using the device’s own Default and policy, then takes the maximum across all devices. This ensures quota is never undercharged even if the deviceSelector matches heterogeneous devices.

  5. The ClusterQueue quota is set in capacity units (e.g., 800Gi for GPU memory) instead of device count.

Quota is a sum across all devices, so it does not show whether a request fits on one device. Free capacity split across several GPUs can admit a workload that no single GPU can hold, and its Pods then stay Pending. To check this before admission, use a topology-aware flavor with the alpha KueueDRADeviceFeasibility feature gate. See Topology-Aware Scheduling with DRA.

Prerequisites

  • Kubernetes 1.36 or later with the DRAConsumableCapacity feature gate enabled (beta, enabled by default in Kubernetes 1.36).
  • A DRA driver that publishes Capacity and AllowMultipleAllocations on devices in ResourceSlice objects.

For setup instructions, see Set Up Dynamic Resource Allocation.

Limitations

The following limitations apply:

  • ResourceClaimTemplates only: Only ResourceClaimTemplate references are supported. Direct ResourceClaim references in the Pod spec are not supported and will result in inadmissible workloads.
  • ExactCount allocation mode only: the All allocation mode is not supported, in an exactly request or in an alternative of a firstAvailable one, except for an excluded DeviceClass. Kueue reads a firstAvailable request only when the KueueDRAIntegrationPrioritizedList feature gate is enabled, or skips it when every alternative names an excluded DeviceClass. That gate is beta and on by default since v0.21; see the note below for what it covers.
  • No device constraints or config: Device constraints (MatchAttribute) and per-request config are not supported.
  • No AdminAccess: Device requests with adminAccess: true are not supported.
  • TAS does not see devices: without Topology-Aware Scheduling with DRA, TAS may place a Pod on a node without the devices its ResourceClaimTemplate requests, and a workload that requests an extended resource only a DeviceClass provides fits on no node.
  • Device taints do not change quota: A tainted device is charged like any other. The per-node check can honor taints; see Device taints.
  • Preemption sees the logical resource, not the DeviceClass: when several DeviceClasses map to one logical resource, Kueue can preempt a workload whose devices are of a class the preemptor cannot use. The preemptor then holds the quota while its Pods wait for devices. firstAvailable requests whose alternatives name different DeviceClasses need such a mapping, so map to one logical resource only classes your users can swap, such as a full A100 and its whole-card MIG slice.
  • firstAvailable requests are charged, within limits: With KueueDRAIntegrationPrioritizedList enabled, a firstAvailable request is charged once, the count every alternative asks for, which is what the scheduler allocates whichever alternative it picks. Every alternative of a request has to ask for the same count and map to the same logical resource; a request whose alternatives differ in count is refused, and so is an alternative on a mapping with a counter or capacity source. An alternative that sets capacity on the subrequest is charged its declared count like any other, so Pods that share one device that allows multiple allocations are each charged a whole device. Capacity sources, which charge the shared amount, are not supported for firstAvailable. When every alternative has a CEL selector, Kueue keeps the Workload pending until one alternative’s selectors match enough devices in the cluster, as for an exactly request, and retries the check with backoff. Beyond that, without KueueDRADeviceFeasibility, Kueue does not check that any alternative can be satisfied by the cluster, so a request whose alternatives are all infeasible holds its quota until the Workload is evicted, for example by WaitForPodsReady where it is configured; with it, such a Workload stays pending instead. The charge lands on the one ResourceFlavor the PodSet is assigned, and the Pods carry that flavor’s node labels, so keep every alternative’s devices behind the same flavors; with a flavor per device model, only the alternative with devices on the assigned flavor can run. With MultiKueue, a firstAvailable request works as an exactly request does: every worker needs the feature gate, the mapping, the ResourceClaimTemplate and every DeviceClass that an alternative names, even one with no devices on that worker. A worker missing one keeps its copy of the Workload inadmissible. Turn the gate on in every worker before the manager: a manager that charges a firstAvailable Workload that no worker admits holds its quota without running it.