Skip to content

Commit e1cf47e

Browse files
authored
Merge pull request #51979 from lauralorenz/51179-tutorial-dra-driver-install-and-observe-134-version
Update DRA tutorial for K8s 1.34
2 parents 87e8804 + b5ca1c9 commit e1cf47e

File tree

4 files changed

+41
-65
lines changed

4 files changed

+41
-65
lines changed

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

Lines changed: 38 additions & 62 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
@@ -55,9 +55,9 @@ new fields in the Pod spec itself.
5555
## {{% heading "prerequisites" %}}
5656

5757
Your cluster should support [RBAC](/docs/reference/access-authn-authz/rbac/).
58-
You can try this tutorial with a cluster using
59-
a different authorization mechanism, but in that case you will have to adapt the
60-
steps around defining roles and permissions.
58+
You can try this tutorial with a cluster using a different authorization
59+
mechanism, but in that case you will have to adapt the steps around defining
60+
roles and permissions.
6161

6262
{{< include "task-tutorial-prereqs.md" >}}
6363

@@ -66,27 +66,9 @@ other types of nodes.
6666

6767
{{< version-check >}}
6868

69-
Your cluster also must be configured to use the Dynamic Resource Allocation
70-
feature.
71-
To enable the DRA feature, you must enable the following feature gates and API groups:
72-
73-
1. Enable the `DynamicResourceAllocation`
74-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
75-
on all of the following components:
76-
77-
* `kube-apiserver`
78-
* `kube-controller-manager`
79-
* `kube-scheduler`
80-
* `kubelet`
81-
82-
1. Enable the following
83-
{{< glossary_tooltip text="API groups" term_id="api-group" >}}:
84-
85-
* `resource.k8s.io/v1beta1`
86-
* `resource.k8s.io/v1beta2`
87-
88-
For more information, see
89-
[Enabling or disabling API groups](/docs/reference/using-api/#enabling-or-disabling).
69+
If your cluster is not currently running Kubernetes {{< skew currentVersion
70+
>}} then please check the documentation for the version of Kubernetes that you
71+
plan to use.
9072

9173

9274
<!-- lessoncontent -->
@@ -174,7 +156,7 @@ dra-example-driver to simulate access to a DRA driver image.
174156
from within one of your cluster's nodes:
175157
176158
```shell
177-
docker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.1.0
159+
docker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0
178160
```
179161
180162
### Deploy the DRA driver components
@@ -363,7 +345,7 @@ variables to see how the Pods have been handled by the system.
363345
364346
The output is similar to this:
365347
```
366-
declare -x GPU_DEVICE_4="gpu-4"
348+
declare -x GPU_DEVICE_0="gpu-0"
367349
```
368350
369351
1. Check the state of the ResourceClaim object:
@@ -391,54 +373,48 @@ variables to see how the Pods have been handled by the system.
391373
```
392374
393375
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"
376+
{{< highlight yaml "linenos=inline, hl_lines=27-30 38-41, style=emacs" >}}
377+
apiVersion: resource.k8s.io/v1
378+
kind: ResourceClaim
379+
metadata:
380+
creationTimestamp: "2025-08-20T18:17:31Z"
401381
finalizers:
402382
- resource.kubernetes.io/delete-protection
403383
name: some-gpu
404384
namespace: dra-tutorial
405-
resourceVersion: "58357"
406-
uid: 79e1e8d8-7e53-4362-aad1-eca97678339e
407-
spec:
385+
resourceVersion: "2326"
386+
uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3
387+
spec:
408388
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'))
389+
requests:
390+
- exactly:
391+
allocationMode: ExactCount
392+
count: 1
393+
deviceClassName: gpu.example.com
394+
selectors:
395+
- cel:
396+
expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))
417397
>= 0
418398
name: some-gpu
419-
status:
399+
status:
420400
allocation:
421-
devices:
401+
devices:
422402
results:
423-
- adminAccess: null
424-
device: gpu-4
425-
driver: gpu.example.com
426-
pool: kind-worker
427-
request: some-gpu
428-
nodeSelector:
403+
- device: gpu-0
404+
driver: gpu.example.com
405+
pool: kind-worker
406+
request: some-gpu
407+
nodeSelector:
429408
nodeSelectorTerms:
430409
- matchFields:
431-
- key: metadata.name
410+
- key: metadata.name
432411
operator: In
433412
values:
434413
- kind-worker
435414
reservedFor:
436415
- name: pod0
437-
resource: pods
438-
uid: fa55b59b-d28d-4f7d-9e5b-ef4c8476dff5
439-
kind: List
440-
metadata:
441-
resourceVersion: ""
416+
resource: pods
417+
uid: c4dadf20-392a-474d-a47b-ab82080c8bd7
442418
{{< /highlight >}}
443419
444420
1. To check how the driver handled device allocation, get the logs for the
@@ -450,8 +426,8 @@ variables to see how the Pods have been handled by the system.
450426
451427
The output is similar to this:
452428
```
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],}]
429+
I0820 18:17:44.131324 1 driver.go:106] PrepareResourceClaims is called: number of claims: 1
430+
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]}]
455431
```
456432
457433
You have now successfully deployed a Pod that claims devices using DRA, verified
@@ -503,7 +479,7 @@ ResourceClaim has a `pending` state until it's referenced in a new Pod.
503479
```
504480
The output is similar to this:
505481
```
506-
I0729 05:13:02.144623 1 driver.go:117] NodeUnPrepareResource is called: number of claims: 1
482+
I0820 18:22:15.629376 1 driver.go:138] UnprepareResourceClaims is called: number of claims: 1
507483
```
508484

509485
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:v0.2.0
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)