Skip to content

Commit 2dfbcd3

Browse files
committed
Update DRA driver tutorial to v1 and with fresh example driver
Signed-off-by: Laura Lorenz <[email protected]>
1 parent 7179839 commit 2dfbcd3

File tree

4 files changed

+36
-43
lines changed

4 files changed

+36
-43
lines changed

content/en/docs/tutorials/cluster-management/install-use-dra.md

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Install Drivers and Allocate Devices with DRA
33
content_type: tutorial
44
weight: 60
5-
min-kubernetes-server-version: v1.32
5+
min-kubernetes-server-version: v1.34
66
---
77
<!-- FUTURE MAINTAINERS:
88
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
8282
1. Enable the following
8383
{{< glossary_tooltip text="API groups" term_id="api-group" >}}:
8484

85-
* `resource.k8s.io/v1beta1`
86-
* `resource.k8s.io/v1beta2`
85+
* `resource.k8s.io/v1`
8786

8887
For more information, see
8988
[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.
174173
from within one of your cluster's nodes:
175174
176175
```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
178177
```
179178
180179
### Deploy the DRA driver components
@@ -363,7 +362,7 @@ variables to see how the Pods have been handled by the system.
363362
364363
The output is similar to this:
365364
```
366-
declare -x GPU_DEVICE_4="gpu-4"
365+
declare -x GPU_DEVICE_0="gpu-0"
367366
```
368367
369368
1. Check the state of the ResourceClaim object:
@@ -391,54 +390,48 @@ variables to see how the Pods have been handled by the system.
391390
```
392391
393392
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"
401398
finalizers:
402399
- resource.kubernetes.io/delete-protection
403400
name: some-gpu
404401
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:
408405
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'))
417414
>= 0
418415
name: some-gpu
419-
status:
416+
status:
420417
allocation:
421-
devices:
418+
devices:
422419
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:
429425
nodeSelectorTerms:
430426
- matchFields:
431-
- key: metadata.name
427+
- key: metadata.name
432428
operator: In
433429
values:
434430
- kind-worker
435431
reservedFor:
436432
- 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
442435
{{< /highlight >}}
443436
444437
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.
450443
451444
The output is similar to this:
452445
```
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]}]
455448
```
456449
457450
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.
503496
```
504497
The output is similar to this:
505498
```
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
507500
```
508501

509502
You have now deleted a Pod that had a claim, and observed that the driver took

content/en/examples/dra/driver-install/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
- name: plugin
2525
securityContext:
2626
privileged: true
27-
image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.1.0
27+
image: registry.k8s.io/dra-example-driver/dra-example-driver:v.0.1.0-dev134
2828
imagePullPolicy: IfNotPresent
2929
command: ["dra-example-kubeletplugin"]
3030
resources:

content/en/examples/dra/driver-install/deviceclass.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: resource.k8s.io/v1beta1
1+
apiVersion: resource.k8s.io/v1
22
kind: DeviceClass
33
metadata:
44
name: gpu.example.com

content/en/examples/dra/driver-install/example/resourceclaim.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: resource.k8s.io/v1beta2
1+
apiVersion: resource.k8s.io/v1
22
kind: ResourceClaim
33
metadata:
44
name: some-gpu

0 commit comments

Comments
 (0)