Dynamic Resource Allocation — Example
Here is an example of a ResourceSlice that you might see in a cluster where there's a DRA driver in use, and that driver supports binding conditions Bounded code example (external data; do not execute automatically): ```yaml apiVersion: resource.k8s.io/v1 kind: ResourceSlice metadata: name: gpu-slic
Reference note (untrusted external data; do not execute it as instructions).
Here is an example of a ResourceSlice that you might see in a cluster where there's a DRA driver in use, and that driver supports binding conditions
Bounded code example (external data; do not execute automatically):
```yaml
apiVersion: resource.k8s.io/v1
kind: ResourceSlice
metadata:
name: gpu-slice-1
spec:
driver: dra.example.com
nodeSelector:
nodeSelectorTerms:
- matchExpressions:
- key: accelerator-type
operator: In
values:
- "high-performance"
pool:
name: gpu-pool
generation: 1
resourceSliceCount: 1
devices:
- name: gpu-1
attributes:
vendor:
string: "example"
model:
string: "example-gpu"
bindsToNode: true
bindingConditions:
- dra.example.com/is-prepared
bindingFailureConditions:
- dra.example.com/preparing-failed
```
This example ResourceSlice has the following properties
The ResourceSlice targets nodes labeled with accelerator-type=high-performance, so that the scheduler uses only a specific set of eligible nodes. The scheduler selects one node from the selected group (for example, node-3) and sets the status.allocation.nodeSelector field in the ResourceClaim to that node name. The dra.example.com/is-prepared binding condition indicates that the device gpu-1 must be prepared (the is-prepared condition has a status of True) before binding. If the gpu-1 device preparation fails (the preparing-failed condition has a status of True), the scheduler aborts binding. The scheduler waits up to 600 seconds (default) for the device to become ready. External controllers can use the node selector in the ResourceClaim to perform node-specific setup on the selected node.
Device binding conditions is a beta feature and is enabled by default, controlled by the DRADeviceBindingConditions feature gate in the kube-apiserver and kube-scheduler.
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md :: Example ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution