From dfeb6894789c5b38b5c302ed4f261fd0091484ee Mon Sep 17 00:00:00 2001 From: Edward Cheng Date: Wed, 24 Jul 2024 20:23:59 +1000 Subject: [PATCH] using pms docker chart for plex --- apps/plex/base/deployment.yaml | 93 ------------------- apps/plex/base/kustomization.yaml | 11 ++- apps/plex/base/service.yaml | 21 ----- apps/plex/base/values.yaml | 38 ++++++++ apps/plex/env/k3s-cluster/ingress.yaml | 31 ------- apps/plex/env/k3s-cluster/kustomization.yaml | 3 +- .../k3s-cluster/templates/plex-config-pv.yaml | 30 ++++++ .../templates/plex-config-pvc.yaml | 15 +++ 8 files changed, 94 insertions(+), 148 deletions(-) delete mode 100644 apps/plex/base/deployment.yaml delete mode 100644 apps/plex/base/service.yaml create mode 100644 apps/plex/base/values.yaml delete mode 100644 apps/plex/env/k3s-cluster/ingress.yaml create mode 100644 resources/app-volumes/env/k3s-cluster/templates/plex-config-pv.yaml create mode 100644 resources/app-volumes/env/k3s-cluster/templates/plex-config-pvc.yaml diff --git a/apps/plex/base/deployment.yaml b/apps/plex/base/deployment.yaml deleted file mode 100644 index 1e03041..0000000 --- a/apps/plex/base/deployment.yaml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: plex - namespace: plex - labels: - app.kubernetes.io/name: plex -spec: - selector: - matchLabels: - app.kubernetes.io/name: plex - template: - metadata: - labels: - app.kubernetes.io/name: plex - spec: - securityContext: - runAsUser: 911 - runAsGroup: 1000 - containers: - - name: plex - image: lscr.io/linuxserver/plex:1.40.4 - securityContext: - allowPrivilegeEscalation: true - env: - - name: PUID - value: "911" - - name: PGID - value: "1000" - - name: TZ - value: "Australia/Sydney" - - name: VERSION - value: docker - - name: PLEX_CLAIM - value: "claim-LHi5dG2J4DyqtFbETDpJ" - ports: - - protocol: TCP - containerPort: 80 - name: http - - protocol: TCP - containerPort: 32400 - name: plex - - protocol: UDP - containerPort: 1900 - name: 1900-udp - - protocol: TCP - containerPort: 8324 - name: 8324-tcp - - protocol: UDP - containerPort: 5353 - name: 5353-udp - - protocol: UDP - containerPort: 32410 - name: 32410-udp - - protocol: UDP - containerPort: 32412 - name: 32412-udp - - protocol: UDP - containerPort: 32413 - name: 32413-udp - - protocol: UDP - containerPort: 32414 - name: 32414-udp - - protocol: TCP - containerPort: 32469 - name: 32469-tcp - volumeMounts: - - name: plex-config - mountPath: /config - - name: plex-tv - mountPath: /tv - - name: plex-movie - mountPath: /movie - - name: plex-music - mountPath: /music - - name: plex-gv - mountPath: /gv - volumes: - - name: plex-config - hostPath: - path: /mnt/nfs/AppData/plex/config - - name: plex-tv - hostPath: - path: /mnt/nfs/AppData/plex/tv - - name: plex-movie - hostPath: - path: /mnt/nfs/AppData/plex/movie - - name: plex-music - hostPath: - path: /mnt/nfs/AppData/plex/music - - name: plex-gv - hostPath: - path: /mnt/nfs/AppData/plex/gv diff --git a/apps/plex/base/kustomization.yaml b/apps/plex/base/kustomization.yaml index 87b09a3..25476dc 100644 --- a/apps/plex/base/kustomization.yaml +++ b/apps/plex/base/kustomization.yaml @@ -2,4 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ./deployment.yaml - - ./service.yaml \ No newline at end of file + - ./service.yaml +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +helmCharts: + - name: plex-media-server + repo: https://raw.githubusercontent.com/plexinc/pms-docker/gh-pages + version: 1.16.0 + releaseName: plex-media-server + valuesFile: values.yaml \ No newline at end of file diff --git a/apps/plex/base/service.yaml b/apps/plex/base/service.yaml deleted file mode 100644 index 3b7adbd..0000000 --- a/apps/plex/base/service.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: plex - namespace: plex - labels: - app.kubernetes.io/name: plex -spec: - selector: - app.kubernetes.io/name: plex - type: ClusterIP - internalTrafficPolicy: Cluster - ports: - - protocol: TCP - port: 8899 - targetPort: 80 - name: http - - protocol: TCP - port: 32400 - targetPort: 32400 - name: plex diff --git a/apps/plex/base/values.yaml b/apps/plex/base/values.yaml new file mode 100644 index 0000000..3547ffd --- /dev/null +++ b/apps/plex/base/values.yaml @@ -0,0 +1,38 @@ +ingress: + enabled: true + ingressClassName: nginx + url: plex.cluster.edward.sydney +pms: + storageClassName: local-path + existingClaim: plex-config-pvc +extraEnv: + PLEX_CLAIM: "" + TZ: "Australia/Sydney" + PLEX_UID: 1000 + PLEX_GID: 1000 +extraVolumeMounts: + - name: plex-tv + mountPath: /tv + - name: plex-movie + mountPath: /movie + - name: plex-music + mountPath: /music + - name: plex-gv + mountPath: /gv +extraVolumes: + - name: plex-tv + hostPath: + path: /mnt/nfs/AppData/plex/tv + type: Directory + - name: plex-movie + hostPath: + path: /mnt/nfs/AppData/plex/movie + type: Directory + - name: plex-music + hostPath: + path: /mnt/nfs/AppData/plex/music + type: Directory + - name: plex-gv + hostPath: + path: /mnt/nfs/AppData/plex/gv + type: Directory \ No newline at end of file diff --git a/apps/plex/env/k3s-cluster/ingress.yaml b/apps/plex/env/k3s-cluster/ingress.yaml deleted file mode 100644 index 644f310..0000000 --- a/apps/plex/env/k3s-cluster/ingress.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: plex-ingress - namespace: plex - annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "false" - nginx.ingress.kubernetes.io/use-regex: "true" -spec: - ingressClassName: nginx - rules: - - host: "plex.cluster.edward.sydney" - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: plex - port: - number: 32400 - - host: "plex-web.cluster.edward.sydney" - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: plex - port: - number: 8899 \ No newline at end of file diff --git a/apps/plex/env/k3s-cluster/kustomization.yaml b/apps/plex/env/k3s-cluster/kustomization.yaml index 3ea3085..a227ac4 100644 --- a/apps/plex/env/k3s-cluster/kustomization.yaml +++ b/apps/plex/env/k3s-cluster/kustomization.yaml @@ -1,5 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - ../../base - - ./ingress.yaml \ No newline at end of file + - ../../base \ No newline at end of file diff --git a/resources/app-volumes/env/k3s-cluster/templates/plex-config-pv.yaml b/resources/app-volumes/env/k3s-cluster/templates/plex-config-pv.yaml new file mode 100644 index 0000000..ee07e59 --- /dev/null +++ b/resources/app-volumes/env/k3s-cluster/templates/plex-config-pv.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: plex-config-pv + namespace: plex + labels: + type: local +spec: + storageClassName: local-path + volumeMode: Filesystem + capacity: + storage: 5Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + local: + path: "/mnt/nfs/AppData/plex/config" + claimRef: + apiVersion: v1 + kind: PersistentVolumeClaim + name: plex-config-pvc + namespace: plex + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - arm64 \ No newline at end of file diff --git a/resources/app-volumes/env/k3s-cluster/templates/plex-config-pvc.yaml b/resources/app-volumes/env/k3s-cluster/templates/plex-config-pvc.yaml new file mode 100644 index 0000000..acb3223 --- /dev/null +++ b/resources/app-volumes/env/k3s-cluster/templates/plex-config-pvc.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: plex-config-pvc + namespace: plex + labels: + name: plex-config-pvc +spec: + storageClassName: local-path + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi \ No newline at end of file