@@ -6,42 +6,44 @@ USB device available to a pod in your Kubernetes cluster.
66## Prerequisites
77
88- A Kubernetes cluster (v1.34+) with DRA enabled
9- - ` kubectl ` configured to access the cluster
10- - A machine with USB devices to share (the Agent host)
11- - The ` usbip ` tools installed on both the Agent host and cluster nodes
9+ - ` kubectl ` and [ Helm] ( https://helm.sh/docs/intro/install/ ) 3.x configured
10+ to access the cluster
11+ - A machine with USB devices to share (the agent host, typically a
12+ Raspberry Pi or similar)
13+ - The ` usbip ` tools installed on both the agent host and cluster nodes
1214- The ` vhci-hcd ` and ` usbip-host ` kernel modules loaded
1315
14- ## 1. Run the Agent
16+ ## 1. Install the agent
1517
16- On the machine with USB devices attached, build and run the Agent binary :
18+ On the machine with USB devices attached, run the install script :
1719
1820``` bash
19- make agent
20- ./agent --bind-all-devices
21+ curl -fsSL https://raw.githubusercontent.com/DiamondLightSource/dra-usbip-driver/main/scripts/install-agent.sh | sudo sh -s -- 0.1.0
2122```
2223
23- The Agent serves device metadata on port 13240. Verify it is working:
24+ This downloads the correct binary for your architecture, installs it as a
25+ systemd service, and starts it. The agent serves device metadata on port
26+ 13240 .
27+
28+ Verify it is working:
2429
2530``` bash
2631curl http://< agent-host> :13240/devices
2732```
2833
2934You should see a JSON array describing the connected USB devices.
3035
31- ## 2. Deploy the Manager
32-
33- The Manager runs inside the cluster and polls Agents for device information.
36+ For more detail see {doc}` /how-to/setup-agent ` .
3437
35- ``` bash
36- kubectl apply -f examples/manager.yaml
37- ```
38+ ## 2. Deploy the manager and plugin
3839
39- Or run the container image directly :
40+ Install the Helm chart, passing the address of your agent host :
4041
4142``` bash
42- kubectl run usbip-manager \
43- --image=ghcr.io/diamondlightsource/dra-usbip-driver-manager:latest \
44- -- --agent=< agent-host>
43+ helm -n kube-system upgrade --install dra-usbip-driver \
44+ oci://ghcr.io/diamondlightsource/charts/dra-usbip-driver \
45+ --version 0.1.0 \
46+ --set ' manager.agents={<agent-host>}'
4547```
4648
4749Check that ResourceSlices have been created:
@@ -50,29 +52,32 @@ Check that ResourceSlices have been created:
5052kubectl get resourceslices
5153```
5254
53- ## 3. Deploy the Plugin DaemonSet
54-
55- The Plugin runs on each node and handles attaching USB/IP devices when pods
56- request them:
57-
58- ``` bash
59- kubectl apply -f examples/plugin-daemonset.yaml
60- ```
55+ For more detail see {doc}` /how-to/deploy ` .
6156
62- ## 4. Create a ResourceClaim and Pod
57+ ## 3. Request a USB device in a pod
6358
64- Create a ResourceClaim to request a USB device, then a Pod that references it:
59+ Create a ` ResourceClaimTemplate ` to match a specific USB device, then
60+ reference it from a pod:
6561
6662``` yaml
6763apiVersion : resource.k8s.io/v1
68- kind : ResourceClaim
64+ kind : ResourceClaimTemplate
6965metadata :
70- name : my-usb-device
66+ name : serial-adapter
7167spec :
72- devices :
73- requests :
74- - name : usb
75- deviceClassName : usbip
68+ spec :
69+ devices :
70+ requests :
71+ - name : req-0
72+ firstAvailable :
73+ - name : adapter
74+ deviceClassName : usbip
75+ selectors :
76+ - cel :
77+ expression : |-
78+ device.attributes["usbip.diamond.ac.uk"].vendor == "0403" &&
79+ device.attributes["usbip.diamond.ac.uk"].product == "6015" &&
80+ device.attributes["usbip.diamond.ac.uk"].serial == "FTA954OZ"
7681 ---
7782apiVersion : v1
7883kind : Pod
8590 command : ["sleep", "infinity"]
8691 resourceClaims :
8792 - name : usb-claim
88- resourceClaimName : my-usb-device
93+ resourceClaimTemplateName : serial-adapter
8994` ` `
9095
9196` ` ` bash
0 commit comments