diff --git a/infrastructure/core/daemonsets/device-plugin-jetson/daemonset.yaml b/infrastructure/core/daemonsets/device-plugin-jetson/daemonset.yaml new file mode 100644 index 0000000..642ff0e --- /dev/null +++ b/infrastructure/core/daemonsets/device-plugin-jetson/daemonset.yaml @@ -0,0 +1,47 @@ +# infrastructure/core/daemonsets/device-plugin-jetson/daemonset.yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: nvidia-device-plugin-jetson + namespace: kube-system + labels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: jetson +spec: + selector: + matchLabels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: jetson + template: + metadata: + labels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: jetson + spec: + nodeSelector: + kubernetes.io/arch: arm64 + jetson: "true" + tolerations: + - operator: Exists + priorityClassName: system-node-critical + containers: + - name: nvidia-device-plugin-ctr + image: nvcr.io/nvidia/k8s-device-plugin:v0.16.2 + imagePullPolicy: IfNotPresent + args: + - "--fail-on-init-error=false" + - "--device-list-strategy=envvar,cdi" + securityContext: + privileged: true + env: + - name: NVIDIA_VISIBLE_DEVICES + value: "all" + - name: NVIDIA_DRIVER_CAPABILITIES + value: "compute,video,utility" + volumeMounts: + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins + volumes: + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins diff --git a/infrastructure/core/daemonsets/device-plugin-jetson/kustomization.yaml b/infrastructure/core/daemonsets/device-plugin-jetson/kustomization.yaml new file mode 100644 index 0000000..5beccfa --- /dev/null +++ b/infrastructure/core/daemonsets/device-plugin-jetson/kustomization.yaml @@ -0,0 +1,4 @@ +# infrastructure/core/daemonsets/device-plugin-jetson/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: [daemonset.yaml] diff --git a/infrastructure/core/daemonsets/device-plugin-minipc/daemonset.yaml b/infrastructure/core/daemonsets/device-plugin-minipc/daemonset.yaml new file mode 100644 index 0000000..c221a67 --- /dev/null +++ b/infrastructure/core/daemonsets/device-plugin-minipc/daemonset.yaml @@ -0,0 +1,47 @@ +# infrastructure/core/daemonsets/device-plugin-minipc/daemonset.yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: nvidia-device-plugin-minipc + namespace: kube-system + labels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: titan22 +spec: + selector: + matchLabels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: titan22 + template: + metadata: + labels: + app.kubernetes.io/name: nvidia-device-plugin + app.kubernetes.io/instance: titan22 + spec: + nodeSelector: + kubernetes.io/hostname: titan-22 + kubernetes.io/arch: amd64 + tolerations: + - operator: Exists + priorityClassName: system-node-critical + containers: + - name: nvidia-device-plugin-ctr + image: nvcr.io/nvidia/k8s-device-plugin:v0.16.2 + imagePullPolicy: IfNotPresent + args: + - "--fail-on-init-error=false" + - "--device-list-strategy=envvar,cdi" + securityContext: + privileged: true + env: + - name: NVIDIA_VISIBLE_DEVICES + value: "all" + - name: NVIDIA_DRIVER_CAPABILITIES + value: "compute,video,utility" + volumeMounts: + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins + volumes: + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins diff --git a/infrastructure/core/daemonsets/device-plugin-minipc/kustomization.yaml b/infrastructure/core/daemonsets/device-plugin-minipc/kustomization.yaml new file mode 100644 index 0000000..a0321fc --- /dev/null +++ b/infrastructure/core/daemonsets/device-plugin-minipc/kustomization.yaml @@ -0,0 +1,4 @@ +# infrastructure/core/daemonsets/device-plugin-minipc/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: [daemonset.yaml] diff --git a/infrastructure/core/daemonsets/kustomization-device-plugin-jetson.yaml b/infrastructure/core/daemonsets/kustomization-device-plugin-jetson.yaml new file mode 100644 index 0000000..b240edc --- /dev/null +++ b/infrastructure/core/daemonsets/kustomization-device-plugin-jetson.yaml @@ -0,0 +1,15 @@ +# infrastructure/core/daemonsets/kustomization-device-plugin-jetson.yaml +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: nvidia-device-plugin-jetson + namespace: flux-system +spec: + suspend: true + interval: 10m + path: ./infrastructure/core/daemonsets/device-plugin-jetson + prune: true + sourceRef: + kind: GitRepository + name: flux-system + namespace: flux-system diff --git a/infrastructure/core/daemonsets/kustomization-device-plugin-minipc.yaml b/infrastructure/core/daemonsets/kustomization-device-plugin-minipc.yaml new file mode 100644 index 0000000..1864223 --- /dev/null +++ b/infrastructure/core/daemonsets/kustomization-device-plugin-minipc.yaml @@ -0,0 +1,15 @@ +# infrastructure/core/daemonsets/kustomization-device-plugin-minipc.yaml +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: nvidia-device-plugin-minipc + namespace: flux-system +spec: + suspend: false + interval: 10m + path: ./infrastructure/core/daemonsets/device-plugin-minipc + prune: true + sourceRef: + kind: GitRepository + name: flux-system + namespace: flux-system diff --git a/infrastructure/core/kustomization.yaml b/infrastructure/core/kustomization.yaml index 79b2d20..a6eefaf 100644 --- a/infrastructure/core/kustomization.yaml +++ b/infrastructure/core/kustomization.yaml @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - sc-asteria.yaml - - sc-astreae.yaml - - pc-scavenger.yaml + - ./storageclass/kustomization.yaml + - ./priorityclass/kustomization.yaml + - ./daemonsets/kustomization-device-plugin-minipc.yaml + - ./daemonsets/kustomization-device-plugin-jetson.yaml diff --git a/infrastructure/core/priorityclass/kustomization.yaml b/infrastructure/core/priorityclass/kustomization.yaml new file mode 100644 index 0000000..19b2a7a --- /dev/null +++ b/infrastructure/core/priorityclass/kustomization.yaml @@ -0,0 +1,5 @@ +# infrastructure/core/priorityclass/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - scavenger.yaml diff --git a/infrastructure/core/pc-scavenger.yaml b/infrastructure/core/priorityclass/scavenger.yaml similarity index 79% rename from infrastructure/core/pc-scavenger.yaml rename to infrastructure/core/priorityclass/scavenger.yaml index bda4e7c..1627535 100644 --- a/infrastructure/core/pc-scavenger.yaml +++ b/infrastructure/core/priorityclass/scavenger.yaml @@ -1,4 +1,4 @@ -# infrastructure/core/pc-scavenger.yaml +# infrastructure/core/priorityclass/scavenger.yaml apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: diff --git a/infrastructure/core/sc-asteria.yaml b/infrastructure/core/storageclass/asteria.yaml similarity index 85% rename from infrastructure/core/sc-asteria.yaml rename to infrastructure/core/storageclass/asteria.yaml index dac21c9..d3c86fe 100644 --- a/infrastructure/core/sc-asteria.yaml +++ b/infrastructure/core/storageclass/asteria.yaml @@ -1,4 +1,4 @@ -# infrastructure/core/sc-asteria.yaml +# infrastructure/core/storageclass/asteria.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: diff --git a/infrastructure/core/sc-astreae.yaml b/infrastructure/core/storageclass/astreae.yaml similarity index 88% rename from infrastructure/core/sc-astreae.yaml rename to infrastructure/core/storageclass/astreae.yaml index 05ab19b..ec9201a 100644 --- a/infrastructure/core/sc-astreae.yaml +++ b/infrastructure/core/storageclass/astreae.yaml @@ -1,4 +1,4 @@ -# infrastructure/core/sc-astreae.yaml +# infrastructure/core/storageclass/astreae.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: diff --git a/infrastructure/core/storageclass/kustomization.yaml b/infrastructure/core/storageclass/kustomization.yaml new file mode 100644 index 0000000..28dc29d --- /dev/null +++ b/infrastructure/core/storageclass/kustomization.yaml @@ -0,0 +1,6 @@ +# infrastructure/core/storageclass/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - asteria.yaml + - astreae.yaml diff --git a/infrastructure/flux-system/kustomization-helm.yaml b/infrastructure/flux-system/kustomization-helm.yaml index 6788b5b..58f0311 100644 --- a/infrastructure/flux-system/kustomization-helm.yaml +++ b/infrastructure/flux-system/kustomization-helm.yaml @@ -1,3 +1,4 @@ +# infrastructure/flux-system/kustomization-helm.yaml apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: diff --git a/infrastructure/flux-system/kustomization-jellyfin.yaml b/infrastructure/flux-system/kustomization-jellyfin.yaml new file mode 100644 index 0000000..b298492 --- /dev/null +++ b/infrastructure/flux-system/kustomization-jellyfin.yaml @@ -0,0 +1,19 @@ +# infrastructure/flux-system/kustomization-jellyfin.yaml +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: jellyfin + namespace: flux-system +spec: + interval: 10m + path: ./services/jellyfin + targetNamespace: jellyfin + prune: true + sourceRef: + kind: GitRepository + name: flux-system + namespace: flux-system + dependsOn: + - name: core + wait: true + timeout: 5m diff --git a/infrastructure/flux-system/kustomization-vault.yaml b/infrastructure/flux-system/kustomization-vault.yaml index 1991a0f..3ee83c6 100644 --- a/infrastructure/flux-system/kustomization-vault.yaml +++ b/infrastructure/flux-system/kustomization-vault.yaml @@ -1,3 +1,4 @@ +# infrastructure/flux-system/kustomization-vault.yaml apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: diff --git a/infrastructure/flux-system/kustomization.yaml b/infrastructure/flux-system/kustomization.yaml index c1ea011..e3437fd 100644 --- a/infrastructure/flux-system/kustomization.yaml +++ b/infrastructure/flux-system/kustomization.yaml @@ -11,4 +11,5 @@ resources: - kustomization-vault.yaml - kustomization-crypto.yaml - kustomization-monerod.yaml +- kustomization-jellyfin.yaml - kustomization-xmr-miner.yaml diff --git a/services/jellyfin/deployment.yaml b/services/jellyfin/deployment.yaml new file mode 100644 index 0000000..4935d0e --- /dev/null +++ b/services/jellyfin/deployment.yaml @@ -0,0 +1,62 @@ +# services/jellyfin/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jellyfin + namespace: jellyfin + labels: + app: jellyfin +spec: + replicas: 1 + selector: + matchLabels: + app: jellyfin + template: + metadata: + labels: + app: jellyfin + spec: + nodeSelector: + jellyfin: "true" + runtimeClassName: nvidia + containers: + - name: jellyfin + image: docker.io/jellyfin/jellyfin:2025082505 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8096 + env: + - name: NVIDIA_DRIVER_CAPABILITIES + value: "compute,video,utility" + - name: JELLYFIN_PublishedServerUrl + value: "https://stream.bstein.dev" + resources: + limits: + nvidia.com/gpu: 1 + # cpu: "4" + # memory: 8Gi + requests: + nvidia.com/gpu: 1 + cpu: "500m" + memory: 1Gi + volumeMounts: + - name: config + mountPath: /config + - name: cache + mountPath: /cache + - name: media + mountPath: /media + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: false + volumes: + - name: config + persistentVolumeClaim: + claimName: jellyfin-config + - name: cache + persistentVolumeClaim: + claimName: jellyfin-cache + - name: media + persistentVolumeClaim: + claimName: jellyfin-media diff --git a/services/jellyfin/ingress.yaml b/services/jellyfin/ingress.yaml new file mode 100644 index 0000000..85a4d1d --- /dev/null +++ b/services/jellyfin/ingress.yaml @@ -0,0 +1,24 @@ +# services/jellyfin/ingress.yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: jellyfin + namespace: jellyfin + annotations: + cert-manager.io/cluster-issuer: letsencrypt +spec: + ingressClassName: traefik + rules: + - host: stream.bstein.dev + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: jellyfin + port: + number: 80 + tls: + - hosts: [stream.bstein.dev] + secretName: jellyfin-tls diff --git a/services/jellyfin/kustomization.yaml b/services/jellyfin/kustomization.yaml new file mode 100644 index 0000000..8c32a29 --- /dev/null +++ b/services/jellyfin/kustomization.yaml @@ -0,0 +1,10 @@ +# services/jellyfin/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - namespace.yaml + - pvc.yaml + - service.yaml + - deployment.yaml + - ingress.yaml + - runtimeclass.yaml diff --git a/services/jellyfin/namespace.yaml b/services/jellyfin/namespace.yaml new file mode 100644 index 0000000..29181f9 --- /dev/null +++ b/services/jellyfin/namespace.yaml @@ -0,0 +1,5 @@ +# services/jellyfin/namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: jellyfin diff --git a/services/jellyfin/pvc.yaml b/services/jellyfin/pvc.yaml new file mode 100644 index 0000000..fd0ab51 --- /dev/null +++ b/services/jellyfin/pvc.yaml @@ -0,0 +1,37 @@ +# services/jellyfin/pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: jellyfin-config + namespace: jellyfin +spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 10Gi + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: jellyfin-cache + namespace: jellyfin +spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 50Gi + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: jellyfin-media + namespace: jellyfin +spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Ti diff --git a/services/jellyfin/runtimeclass.yaml b/services/jellyfin/runtimeclass.yaml new file mode 100644 index 0000000..c89d267 --- /dev/null +++ b/services/jellyfin/runtimeclass.yaml @@ -0,0 +1,6 @@ +# services/jellyfin/runtimeclass.yaml +apiVersion: node.k8s.io/v1 +kind: RuntimeClass +metadata: + name: nvidia +handler: nvidia diff --git a/services/jellyfin/service.yaml b/services/jellyfin/service.yaml new file mode 100644 index 0000000..f68a56b --- /dev/null +++ b/services/jellyfin/service.yaml @@ -0,0 +1,14 @@ +# services/jellyfin/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: jellyfin + namespace: jellyfin +spec: + type: ClusterIP + selector: + app: jellyfin + ports: + - name: http + port: 80 + targetPort: 8096