Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.

Commit 3181825

Browse files
fabiandmpolednik
authored andcommitted
kvm: Add DaemonSet example
The daemonset can be used to deploy the kvm device-plugin on all nodes of a cluster. Signed-off-by: Fabian Deutsch <[email protected]>
1 parent 7697dca commit 3181825

File tree

4 files changed

+53
-6
lines changed

4 files changed

+53
-6
lines changed

cmd/kvm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ FROM fedora:27
22

33
COPY kvm /kvm
44

5-
CMD ["/kvm"]
5+
ENTRYPOINT ["/kvm"]

docs/kvm/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@ sudo ./kvm -v 3 -logtostderr
3333

3434
### Docker
3535
```
36-
docker run -it -v /dev:/dev -v /sys:/sys -v /lib/modules:/lib/modules -v /var/lib/kubelet/device-plugins:/var/lib/kubelet/device-plugins --privileged --cap-add=ALL kvm:latest /bin/bash
36+
docker run -it -v /var/lib/kubelet/device-plugins:/var/lib/kubelet/device-plugins --privileged --cap-add=ALL kvm:latest /bin/bash
3737
(in docker image) ./kvm -v 3 -logtostderr
3838
```
3939

4040
## As a DaemonSet
4141

42-
NOTE: This process is not finalized yet.
42+
```
43+
# Deploy the device plugin
44+
kubectl apply -f manifests/kvm-ds.yml
45+
46+
# Optionally you can now test it using an example consumer
47+
kubectl apply -f docs/kvm/consumer.yml
48+
kubectl exec -it kvm-consumer -- ls /dev/kvm
49+
```
4350

4451
## API
4552

@@ -48,7 +55,7 @@ Node description:
4855
```yaml
4956
Capacity:
5057
...
51-
devices.kubevirt.io/kvm: 3
58+
devices.kubevirt.io/kvm: "3"
5259
...
5360
```
5461

@@ -61,9 +68,9 @@ spec:
6168
...
6269
resources:
6370
requests:
64-
devices.kubevirt.io/kvm: 1
71+
devices.kubevirt.io/kvm: "1"
6572
limits:
66-
devices.kubevirt.io/kvm: 1
73+
devices.kubevirt.io/kvm: "1"
6774
```
6875
6976
## Issues

docs/kvm/consumer-pod.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: kvm-consumer
5+
spec:
6+
containers:
7+
- name: busybox
8+
image: busybox
9+
command: ["/bin/sleep", "123"]
10+
resources:
11+
limits:
12+
devices.kubevirt.io/kvm: 1

manifests/kvm-ds.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
labels:
5+
name: device-plugin-kvm
6+
name: device-plugin-kvm
7+
spec:
8+
selector:
9+
matchLabels:
10+
name: device-plugin-kvm
11+
template:
12+
metadata:
13+
labels:
14+
name: device-plugin-kvm
15+
spec:
16+
containers:
17+
- name: device-plugin-kvm
18+
image: quay.io/kubevirt/device-plugin-kvm
19+
args: ["-v3", "-logtostderr"]
20+
securityContext:
21+
privileged: true
22+
volumeMounts:
23+
- name: device-plugin
24+
mountPath: /var/lib/kubelet/device-plugins
25+
volumes:
26+
- name: device-plugin
27+
hostPath:
28+
path: /var/lib/kubelet/device-plugins

0 commit comments

Comments
 (0)