From 7fbc9cdd3db2de48a7e006e9482e2bce44117755 Mon Sep 17 00:00:00 2001 From: Nathan Rashleigh Date: Mon, 10 Mar 2025 14:22:19 +1100 Subject: [PATCH] storage --- README.md | 4 +- media/jellyfin-ingress.yaml | 39 ++++++++++++++ media/jellyfin.yaml | 95 +++++++++++++++++++++++++++++++++ {jellyfin => media}/nvidia.yaml | 22 ++++++++ networking/haproxy.yaml | 9 ++-- networking/pihole.yaml | 6 ++- storage/openebs.yaml | 92 +++++++++++++++++++++++++++++++ 7 files changed, 261 insertions(+), 6 deletions(-) create mode 100644 media/jellyfin-ingress.yaml create mode 100644 media/jellyfin.yaml rename {jellyfin => media}/nvidia.yaml (59%) create mode 100644 storage/openebs.yaml diff --git a/README.md b/README.md index 771ee25..177bb61 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,6 @@ [x] ntr-cv static containers [x] check mnmlgg mail [x] ufw -[x] grafana etc \ No newline at end of file +[x] grafana etc + +kubectl run -i --tty --rm debug --image=busybox --restart=Never -- nslookup openebs-etcd.openebs.svc.cluster.local diff --git a/media/jellyfin-ingress.yaml b/media/jellyfin-ingress.yaml new file mode 100644 index 0000000..6529793 --- /dev/null +++ b/media/jellyfin-ingress.yaml @@ -0,0 +1,39 @@ +--- + +apiVersion: v1 +kind: Service +metadata: + labels: + app: jellyfin + name: jellyfin + namespace: media +spec: + ports: + - name: web + port: 8096 + protocol: TCP + targetPort: 8096 + selector: + app: jellyfin + type: ClusterIP + +--- + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: jellyfin-ingress + namespace: media +spec: + ingressClassName: haproxy + rules: + - host: jellyfin.nightowl.strix.systems + http: + paths: + - backend: + service: + name: jellyfin + port: + name: web + path: / + pathType: Prefix \ No newline at end of file diff --git a/media/jellyfin.yaml b/media/jellyfin.yaml new file mode 100644 index 0000000..e02a501 --- /dev/null +++ b/media/jellyfin.yaml @@ -0,0 +1,95 @@ +--- + +apiVersion: v1 +kind: Namespace +metadata: + name: media + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jellyfin + namespace: media +spec: + selector: + matchLabels: + app: jellyfin + template: + metadata: + labels: + app: jellyfin + spec: + + # USE GPU + runtimeClassName: nvidia + + containers: + - env: + - name: NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: jellyfin/jellyfin + imagePullPolicy: IfNotPresent + name: jellyfin + ports: + - containerPort: 8096 + protocol: TCP + volumeMounts: + - mountPath: /media + name: jellyfin-media + readOnly: True + - mountPath: /config + name: jellyfin-config + restartPolicy: Always + volumes: + - name: jellyfin-media + persistentVolumeClaim: + claimName: jellyfin-media + - name: jellyfin-config + persistentVolumeClaim: + claimName: jellyfin-config + +--- + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: jellyfin-media + namespace: media +spec: + storageClassName: slow + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 32Gi + +--- + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: jellyfin-config + namespace: media +spec: + storageClassName: fast + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 8Gi + diff --git a/jellyfin/nvidia.yaml b/media/nvidia.yaml similarity index 59% rename from jellyfin/nvidia.yaml rename to media/nvidia.yaml index 0869780..bb19e5f 100644 --- a/jellyfin/nvidia.yaml +++ b/media/nvidia.yaml @@ -1,3 +1,25 @@ +--- + +apiVersion: v1 +kind: Namespace +metadata: + name: gpu-operator + +--- + +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: gpu-operator + namespace: gpu-operator +spec: + repo: https://helm.ngc.nvidia.com/nvidia + chart: gpu-operator + targetNamespace: gpu-operator + version: 24.9.2 + +--- + apiVersion: v1 kind: Pod metadata: diff --git a/networking/haproxy.yaml b/networking/haproxy.yaml index 5041566..35b814d 100644 --- a/networking/haproxy.yaml +++ b/networking/haproxy.yaml @@ -15,7 +15,8 @@ spec: repo: https://haproxytech.github.io/helm-charts chart: kubernetes-ingress targetNamespace: networking - # valuesContent: |- - # controller: - # deployment: - # useHostPort: true \ No newline at end of file + valuesContent: |- + controller: + kind: DaemonSet + daemonset: + useHostPort: true \ No newline at end of file diff --git a/networking/pihole.yaml b/networking/pihole.yaml index aaf452e..9338516 100644 --- a/networking/pihole.yaml +++ b/networking/pihole.yaml @@ -31,6 +31,10 @@ spec: # allow it to respond to devices outside cluster - name: FTLCONF_dns_listeningMode value: single + + # resolve wildcards + - name: FTLCONF_misc_dnsmasq_lines + value: address=/nightowl.strix.systems/192.168.1.88 ports: - containerPort: 53 protocol: TCP @@ -152,7 +156,7 @@ metadata: spec: ingressClassName: haproxy rules: - - host: "pihole.nightowl.hayst" + - host: "pihole.nightowl.strix.systems" http: paths: - path: / diff --git a/storage/openebs.yaml b/storage/openebs.yaml new file mode 100644 index 0000000..8361e4d --- /dev/null +++ b/storage/openebs.yaml @@ -0,0 +1,92 @@ +--- + +apiVersion: v1 +kind: Namespace +metadata: + name: openebs + +--- +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: openebs + namespace: openebs +spec: + repo: https://openebs.github.io/openebs/ + chart: openebs + targetNamespace: openebs + valuesContent: |- + engines: + replicated: + mayastor: + enabled: false + local: + lvm: + enabled: false + +--- + +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: zfs-fast +parameters: + poolname: "fast/k8s" + recordsize: "128k" + + compression: "off" + dedup: "off" + fstype: "zfs" + +provisioner: zfs.csi.openebs.io + +--- + +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: zfs-slow +parameters: + poolname: "slow/k8s" + # https://www.zfshandbook.com/docs/advanced-zfs/performance-tuning/ + recordsize: "1M" + + compression: "off" + dedup: "off" + fstype: "zfs" + +provisioner: zfs.csi.openebs.io + +--- + +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: fast + annotations: + cas.openebs.io/config: | + - name: StorageType + value: "hostpath" + - name: BasePath + value: "/fast/k8s/" + openebs.io/cas-type: local +provisioner: openebs.io/local +reclaimPolicy: Retain +volumeBindingMode: WaitForFirstConsumer + +--- + +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: slow + annotations: + cas.openebs.io/config: | + - name: StorageType + value: "hostpath" + - name: BasePath + value: "/slow/k8s/" + openebs.io/cas-type: local +provisioner: openebs.io/local +reclaimPolicy: Retain +volumeBindingMode: WaitForFirstConsumer