kube-plex is a scalable Plex Media Server solution for Kubernetes. It distributes transcode jobs by creating pods in a Kubernetes cluster to perform transcodes, instead of running transcodes on the Plex Media Server instance itself.
kube-plex works by replacing the Plex Transcoder program on the main PMS instance with our own little shim. This shim intercepts calls to Plex Transcoder, and creates Kubernetes pods to perform the work instead. These pods use shared persistent volumes to store the results of the transcode (and read your media!).
- A persistent volume type that supports ReadWriteMany volumes (e.g. NFS, Amazon EFS)
- A Kubernetes LoadBalancer type when declaring the Service
- Your Plex Media Server must be configured to allow connections from unauthorized users for your pod network, else the transcode job is unable to report information back to Plex about the state of the transcode job. At some point in the future this may change, but it is a required step in order to make transcodes work right now.
- Define Storage Class
kubectl apply -f StorageClasses/vsan-thin-disk-sc.yaml
- Define Persistent Volume Claims (as per declaration in charts/kube-plex/values.yaml)
kubectl apply \
--namespace plex \
-f PersistentVolumeClaims/plex-config-pvc.yaml \
-f PersistentVolumeClaims/plex-data-pvc.yaml \
-f PersistentVolumeClaims/plex-transcode-pvc.yaml \
-f PersistentVolumeClaims/plex-master-pvc.yaml
-
Install MetalLB (or any other Load Balancer of your choice) if no LoadBalancer type available in your current Cluster
I would recommend this guide, but feel free to pick another that suits you.
This guide will go through setting up a Plex Media Server instance on a Kubernetes cluster, configured to launch transcode jobs on the same cluster in pods created in the same 'plex' namespace.
-
Obtain a Plex Claim Token by visiting plex.tv/claim. This will be used to bind your new PMS instance to your own user account automatically.
-
Deploy the Helm chart included in this repository using the claim token obtained in step 1.
helm install ./charts/kube-plex --name plex \
--namespace plex \
--set claimToken=[insert claim token here] \
--set ingress.enabled=true
This will deploy a scalable Plex Media Server instance that uses Kubernetes as a backend for executing transcode jobs.
- Retrieve the IP assigned to the service plex-kube-plex
kubectl describe service plex-kube-plex --namespace plex
- Visit Settings->Server->Network (Click 'Show Advanced' if needed) and add
your pod network subnet to the
List of IP addresses and networks that are allowed without auth
(near the bottom). For example,10.100.0.0/16
is the subnet that pods in my cluster are assigned IPs from, so I enter10.100.0.0/16
in the box. ==> To find your, check the --cluster-cidr vallue in one of your K8s node in the /etc/kubernetes/manifests/kube-proxy.manifest file
cat /etc/kubernetes/manifests/kube-proxy.manifest | grep "--cluster-cidr"
You should now be able to play media from your PMS instance - pods will be created to handle transcodes, and data automatically mounted in appropriately:
kubectl get po -n plex
NAME READY STATUS RESTARTS AGE
plex-kube-plex-75b96cdcb4-skrxr 1/1 Running 0 14m
pms-elastic-transcoder-7wnqk 1/1 Running 0 8m