From 6d3d3391441ba32f5d4a10e3cae7dda95d45abfa Mon Sep 17 00:00:00 2001 From: "slavik.fursov" Date: Wed, 15 May 2024 15:42:24 -0700 Subject: [PATCH] add Kubernetes manifest. Fixes #687 --- kube-dsm.yaml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 12 +++++++++++ 2 files changed, 72 insertions(+) create mode 100644 kube-dsm.yaml diff --git a/kube-dsm.yaml b/kube-dsm.yaml new file mode 100644 index 00000000..ea38cb57 --- /dev/null +++ b/kube-dsm.yaml @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: dsm-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 32Gi +--- +apiVersion: v1 +kind: Pod +metadata: + name: dsm + 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 + resources: + limits: + devices.kubevirt.io/kvm: 1 + securityContext: + privileged: true + env: + - name: RAM_SIZE + value: 4G + - name: CPU_CORES + value: "2" + - name: DISK_SIZE + value: "30G" # Kubernetes uses Gi, but DSM uses GB + - name: DISK_FMT + value: "qcow2" + volumeMounts: + - mountPath: /storage + name: storage + volumes: + - name: storage + persistentVolumeClaim: + claimName: dsm-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: dsm +spec: + type: NodePort + selector: + name: dsm + ports: + - name: tcp-5000 + port: 5000 + targetPort: 5000 + nodePort: 31150 diff --git a/readme.md b/readme.md index 0c87fbb1..2ca62639 100644 --- a/readme.md +++ b/readme.md @@ -47,6 +47,18 @@ Via Docker CLI: docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 vdsm/virtual-dsm ``` +Via Kubernetes: +- download `kube-dsm.yaml` +- edit it, according to your need +- deploy it: +```shell +kubectl apply -f kube-dsm.yaml +``` + +Notes: +- depending on the kind of storage you're using, you may want to pre-create PVC first. If so - remove PVC section from the manifest +- you can add Ingress to the manifest. I found, that if I use DNS name to access DSM UI - that can only be done via HTTPS. Accessing UI via DNS with HTTP results in error `You are not authorized to use this service` + ## FAQ * ### How do I use it?