2
2
title : Install Drivers and Allocate Devices with DRA
3
3
content_type : tutorial
4
4
weight : 60
5
- min-kubernetes-server-version : v1.32
5
+ min-kubernetes-server-version : v1.34
6
6
---
7
7
<!-- FUTURE MAINTAINERS:
8
8
The original point of this doc was for people (mainly cluster administrators) to
@@ -82,8 +82,7 @@ To enable the DRA feature, you must enable the following feature gates and API g
82
82
1 . Enable the following
83
83
{{< glossary_tooltip text="API groups" term_id="api-group" >}}:
84
84
85
- * ` resource.k8s.io/v1beta1 `
86
- * ` resource.k8s.io/v1beta2 `
85
+ * ` resource.k8s.io/v1 `
87
86
88
87
For more information, see
89
88
[ Enabling or disabling API groups] ( /docs/reference/using-api/#enabling-or-disabling ) .
@@ -174,7 +173,7 @@ dra-example-driver to simulate access to a DRA driver image.
174
173
from within one of your cluster' s nodes:
175
174
176
175
```shell
177
- docker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.1.0
176
+ docker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.1.0-dev134
178
177
```
179
178
180
179
### Deploy the DRA driver components
@@ -363,7 +362,7 @@ variables to see how the Pods have been handled by the system.
363
362
364
363
The output is similar to this:
365
364
```
366
- declare -x GPU_DEVICE_4 ="gpu-4 "
365
+ declare -x GPU_DEVICE_0 ="gpu-0 "
367
366
```
368
367
369
368
1. Check the state of the ResourceClaim object:
@@ -391,54 +390,48 @@ variables to see how the Pods have been handled by the system.
391
390
```
392
391
393
392
The output is similar to this:
394
- {{< highlight yaml "linenos=inline, hl_lines=30-33 41-44, style=emacs" >}}
395
- apiVersion: v1
396
- items:
397
- - apiVersion: resource.k8s.io/v1beta2
398
- kind: ResourceClaim
399
- metadata:
400
- creationTimestamp: "2025-07-29T05:11:52Z"
393
+ {{< highlight yaml "linenos=inline, hl_lines=27-30 38-41, style=emacs" >}}
394
+ apiVersion: resource.k8s.io/v1
395
+ kind: ResourceClaim
396
+ metadata:
397
+ creationTimestamp: "2025-08-20T18:17:31Z"
401
398
finalizers:
402
399
- resource.kubernetes.io/delete-protection
403
400
name: some-gpu
404
401
namespace: dra-tutorial
405
- resourceVersion: "58357 "
406
- uid: 79e1e8d8-7e53-4362-aad1-eca97678339e
407
- spec:
402
+ resourceVersion: "2326 "
403
+ uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3
404
+ spec:
408
405
devices:
409
- requests:
410
- - exactly:
411
- allocationMode: ExactCount
412
- count: 1
413
- deviceClassName: gpu.example.com
414
- selectors:
415
- - cel:
416
- expression: device.capacity[' gpu.example.com' ].memory.compareTo(quantity(' 10Gi' ))
406
+ requests:
407
+ - exactly:
408
+ allocationMode: ExactCount
409
+ count: 1
410
+ deviceClassName: gpu.example.com
411
+ selectors:
412
+ - cel:
413
+ expression: device.capacity[' gpu.example.com' ].memory.compareTo(quantity(' 10Gi' ))
417
414
>= 0
418
415
name: some-gpu
419
- status:
416
+ status:
420
417
allocation:
421
- devices:
418
+ devices:
422
419
results:
423
- - adminAccess: null
424
- device: gpu-4
425
- driver: gpu.example.com
426
- pool: kind-worker
427
- request: some-gpu
428
- nodeSelector:
420
+ - device: gpu-0
421
+ driver: gpu.example.com
422
+ pool: kind-worker
423
+ request: some-gpu
424
+ nodeSelector:
429
425
nodeSelectorTerms:
430
426
- matchFields:
431
- - key: metadata.name
427
+ - key: metadata.name
432
428
operator: In
433
429
values:
434
430
- kind-worker
435
431
reservedFor:
436
432
- name: pod0
437
- resource: pods
438
- uid: fa55b59b-d28d-4f7d-9e5b-ef4c8476dff5
439
- kind: List
440
- metadata:
441
- resourceVersion: ""
433
+ resource: pods
434
+ uid: c4dadf20-392a-474d-a47b-ab82080c8bd7
442
435
{{< /highlight >}}
443
436
444
437
1. To check how the driver handled device allocation, get the logs for the
@@ -450,8 +443,8 @@ variables to see how the Pods have been handled by the system.
450
443
451
444
The output is similar to this:
452
445
```
453
- I0729 05:11:52.679057 1 driver.go:84] NodePrepareResource is called: number of claims: 1
454
- I0729 05:11:52.684450 1 driver.go:112 ] Returning newly prepared devices for claim ' 79e1e8d8-7e53-4362-aad1-eca97678339e ' : [&Device{RequestNames: [some-gpu],PoolName: kind-worker,DeviceName: gpu-4,CDIDeviceIDs: [k8s.gpu.example.com/gpu=common k8s.gpu.example.com/gpu=79e1e8d8-7e53-4362-aad1-eca97678339e -gpu-4], }]
446
+ I0820 18:17:44.131324 1 driver.go:106] PrepareResourceClaims is called: number of claims: 1
447
+ I0820 18:17:44.135056 1 driver.go:133 ] Returning newly prepared devices for claim ' d3e48dbf-40da-47c3-a7b9-f7d54d1051c3 ' : [{ [some-gpu] kind-worker gpu-0 [k8s.gpu.example.com/gpu=common k8s.gpu.example.com/gpu=d3e48dbf-40da-47c3-a7b9-f7d54d1051c3 -gpu-0] }]
455
448
```
456
449
457
450
You have now successfully deployed a Pod that claims devices using DRA, verified
@@ -503,7 +496,7 @@ ResourceClaim has a `pending` state until it's referenced in a new Pod.
503
496
` ` `
504
497
The output is similar to this:
505
498
```
506
- I0729 05:13:02.144623 1 driver.go:117] NodeUnPrepareResource is called: number of claims: 1
499
+ I0820 18:22:15.629376 1 driver.go:138] UnprepareResourceClaims is called: number of claims: 1
507
500
```
508
501
509
502
You have now deleted a Pod that had a claim, and observed that the driver took
0 commit comments