Skip to content

Commit

Permalink
docs: Add TUN device (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 1, 2024
1 parent 898499a commit 2827d1d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
1 change: 1 addition & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
DISK_SIZE: "16G"
devices:
- /dev/kvm
- /dev/net/tun
cap_add:
- NET_ADMIN
ports:
Expand Down
72 changes: 40 additions & 32 deletions kubernetes.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dsm-pvc
spec:
accessModes:
- ReadWriteOnce
- ReadWriteOnce
resources:
requests:
storage: 16Gi
Expand All @@ -16,44 +17,51 @@ metadata:
labels:
name: dsm
spec:
terminationGracePeriodSeconds: 120 # the Kubernetes default is 30 seconds and it may be not enough
containers:
- name: dsm
image: vdsm/virtual-dsm
ports:
- containerPort: 5000
protocol: TCP
securityContext:
privileged: true
env:
- name: RAM_SIZE
value: 1G
- name: CPU_CORES
value: "1"
- name: DISK_SIZE
value: "16G" # Kubernetes uses Gi, but DSM uses GB
volumeMounts:
- mountPath: /storage
name: storage
- mountPath: /dev/kvm
name: dev-kvm
- name: dsm
image: vdsm/virtual-dsm
env:
- name: RAM_SIZE
value: "1G"
- name: CPU_CORES
value: "1"
- name: DISK_SIZE
value: "16G"
ports:
- containerPort: 5000
securityContext:
capabilities:
add:
- NET_ADMIN
privileged: true
volumeMounts:
- mountPath: /storage
name: storage
- mountPath: /dev/kvm
name: dev-kvm
- mountPath: /dev/net/tun
name: dev-tun
terminationGracePeriodSeconds: 120
volumes:
- name: storage
persistentVolumeClaim:
claimName: dsm-pvc
- name: dev-kvm
hostPath:
path: /dev/kvm
- name: storage
persistentVolumeClaim:
claimName: dsm-pvc
- hostPath:
path: /dev/kvm
name: dev-kvm
- hostPath:
path: /dev/net/tun
type: CharDevice
name: dev-tun
---
apiVersion: v1
kind: Service
metadata:
name: dsm
spec:
type: NodePort
ports:
- name: tcp-5000
port: 5000
selector:
name: dsm
ports:
- name: tcp-5000
port: 5000
targetPort: 5000
type: NodePort
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
DISK_SIZE: "16G"
devices:
- /dev/kvm
- /dev/net/tun
cap_add:
- NET_ADMIN
ports:
Expand All @@ -45,7 +46,7 @@ services:
Via Docker CLI:
```bash
docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 vdsm/virtual-dsm
docker run -it --rm -p 5000:5000 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN --stop-timeout 120 vdsm/virtual-dsm
```

Via Kubernetes:
Expand Down

0 comments on commit 2827d1d

Please sign in to comment.