@@ -6,42 +6,45 @@ 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 -fsSLO https://raw.githubusercontent.com/DiamondLightSource/dra-usbip-driver/main/scripts/install- agent.sh
22+ sudo sh install-agent.sh 0.1.0
2123```
2224
23- The Agent serves device metadata on port 13240. Verify it is working:
25+ This downloads the correct binary for your architecture, installs it as a
26+ systemd service, and starts it. The agent serves device metadata on port
27+ 13240 .
28+
29+ Verify it is working:
2430
2531``` bash
2632curl http://< agent-host> :13240/devices
2733```
2834
2935You should see a JSON array describing the connected USB devices.
3036
31- ## 2. Deploy the Manager
32-
33- The Manager runs inside the cluster and polls Agents for device information.
37+ For more detail see {doc}` /how-to/setup-agent ` .
3438
35- ``` bash
36- kubectl apply -f examples/manager.yaml
37- ```
39+ ## 2. Deploy the manager and plugin
3840
39- Or run the container image directly :
41+ Install the Helm chart, passing the address of your agent host :
4042
4143``` bash
42- kubectl run usbip-manager \
43- --image=ghcr.io/diamondlightsource/dra-usbip-driver-manager:latest \
44- -- --agent=< agent-host>
44+ helm -n kube-system upgrade --install dra-usbip-driver \
45+ oci://ghcr.io/diamondlightsource/charts/dra-usbip-driver \
46+ --version 0.1.0 \
47+ --set ' manager.agents={<agent-host>}'
4548```
4649
4750Check that ResourceSlices have been created:
@@ -50,29 +53,32 @@ Check that ResourceSlices have been created:
5053kubectl get resourceslices
5154```
5255
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- ```
56+ For more detail see {doc}` /how-to/deploy ` .
6157
62- ## 4. Create a ResourceClaim and Pod
58+ ## 3. Request a USB device in a pod
6359
64- Create a ResourceClaim to request a USB device, then a Pod that references it:
60+ Create a ` ResourceClaimTemplate ` to match a specific USB device, then
61+ reference it from a pod:
6562
6663``` yaml
6764apiVersion : resource.k8s.io/v1
68- kind : ResourceClaim
65+ kind : ResourceClaimTemplate
6966metadata :
70- name : my-usb-device
67+ name : serial-adapter
7168spec :
72- devices :
73- requests :
74- - name : usb
75- deviceClassName : usbip
69+ spec :
70+ devices :
71+ requests :
72+ - name : req-0
73+ firstAvailable :
74+ - name : adapter
75+ deviceClassName : usbip
76+ selectors :
77+ - cel :
78+ expression : |-
79+ device.attributes["usbip.diamond.ac.uk"].vendor == "0403" &&
80+ device.attributes["usbip.diamond.ac.uk"].product == "6015" &&
81+ device.attributes["usbip.diamond.ac.uk"].serial == "FTA954OZ"
7682 ---
7783apiVersion : v1
7884kind : Pod
8591 command : ["sleep", "infinity"]
8692 resourceClaims :
8793 - name : usb-claim
88- resourceClaimName : my-usb-device
94+ resourceClaimTemplateName : serial-adapter
8995` ` `
9096
9197` ` ` bash
0 commit comments