justingarfield / helm-plex-media-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

helm-plex-media-server

This repository contains the files I use to provision my Plex Media Server (PMS) container inside of Kubernetes using Helm.

Assumptions

  • You are running Kubernetes 1.25 under Microk8s w/ DNS addon, on Ubuntu Linux 22.04 add link to Documentation
  • Your Media files are exposed via an SMB Share
  • You don't care about using Host Networking (will be swapping out for Bridged-mode eventually)

What's in the box?

File Description
/csi-driver-smb/microk8s-values.yml Used when installing the csi-driver-smb CSI to make it work with Microk8s.
/persistent-volume-claims.yml Collection of PersistentVolumeClaims used for PMS
- plex-data-pvc - Reserves its corresponding PersistentVolume (plex-data-pv) so that it will be pre-existing to pass into the K8s-at-home Helm Chart.
- media-pvc - Reserves its corresponding PersistentVolume (media-pv) so that it will be pre-existing to pass into the K8s-at-home Helm Chart.
/persistent-volumes.yml Collection of PersistentVolumes used for PMS
- plex-data-pv - Points to wherever you want to store your Plex Media Server data.
- media-pv - Points to wherever you host your Media files.
/values.yml Overrides and preferences for the k8s-at-home/plex Helm chart. Do all your big configuration stuff here.
- TZ - Set the Pod/Container timezone
- env.PLEX_PREFERENCE_XX - Override/Set a buttload of PMS settings up-front, so we can re-create / not have to go through Web UI
- hostNetwork - Set to true (for now, until Bridged Networking is solved)
- dnsPolicy - Set this to ClusterFirstWithHostNet to work with hostNetwork
- dnsConfig - Had to configure ndots to 1 in order for DNS lookups to function under Microk8s / CoreDNS / hostNetwork mode
- persistence.transcode - Set medium: Memory to put /transcode mapped-volume into memory-backed tmpfs

Configuration / Usage

Installing the SMB CSI

helm repo add csi-driver-smb https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts
helm install csi-driver-smb csi-driver-smb/csi-driver-smb --create-namespace --namespace csi-driver-smb --version v1.9.0 -f ./csi-driver-smb/microk8s-values.yml

Create a Namespace for PMS

kubectl create namespace plex-media-server

Configure SMB Credentials, PersistentVolumes, and PersistentVolumeClaims

kubectl -n plex-media-server create secret generic smbcreds --from-literal username=<SMB Share username> --from-literal password="<SMB Share password>"

kubectl create -f persistent-volumes.yml

kubectl -n plex-media-server create -f persistent-volume-claims.yml

Provision PMS

Visit https://www.plex.tv/claim/, login, and get a Claims Token prepared.

helm install plex-media-server k8s-at-home/plex -n plex-media-server -f values.yml --set env.PLEX_CLAIM=<claims token here>

Side Notes

  • Quick Commands Reference

    • helm delete plex-media-server -n plex-media-server
    • kubectl -n plex-media-server delete -f persistent-volume-claims.yml
    • kubectl delete -f persistent-volumes.yml
    • kubectl -n plex-media-server delete secret smbcreds
    • kubectl delete namespace plex-media-server
  • If you sudo snap remove microk8s to wipe the slate clean...

    • Be sure to ip a and check for calico/flannel related interfaces. Sometimes they don't all get cleaned up properly, and you need to sudo ip link del <if name> them
    • Be sure to cleanup any saved snapshots you no longer care about (sudo snap saved and sudo snap forget)
  • Directories to be aware of

    • plex-data-pv:Library/Application Support/Plex Media Server
    • plex-data-pv:Library/Application Support/Plex Media Server/Crash Reports
    • plex-data-pv:Library/Application Support/Plex Media Server/Logs
    • plex-data-pv:Library/Application Support/Plex Media Server/Preferences.xml
  • Found a buttload of PMS configuration/env var settings located at http://127.0.0.1:32400/:/prefs when the Web UI loads up. (Watch the Network / XHR tab for this)

  • Found an interesting project to look into possibly: kube-plex

References

About