Plex on Kubernetes - a story of a total disaster

Server Version#: 1.25.3.5409
Player Version#: all

I would like to tell you about my experience with Plex:

  1. I installed Plex server on my old NAS drive more than a year ago and I built a small database to test the service and it worked fine for some old movies, but the NAS CPU was slow for the newer one, so I decided to buy a dedicated Plex server.
  2. I bought a mini-PC, I7 CPU, really powerful. I installed Ubuntu on it and Linux version of Plex, Even the biggest movies worked perfect. Then I realised that the Plex database is huge and decided to test the Docker version (I have some knowledge on cloud technologies) so I could keep that database on different HDD partition and update the Plex versions easier
  3. That server worked for about a month without any issues and then started freezing. I still dont know why. I’m investigating the issues on that PC. I hope it is not related with Plex. While Idle, without any reason, every port of the PC is cut but the CPU runs.
  4. In order to provide better access to my media I decided to build a small Kubernetes cluster: a I3 CPU as master node, and the first I7 CPU as worker node. If the worker gets down, the master could host the Plex for a while. The Plex database was migrated on the NAS and the NAS was connected via NFS protocol. On theory that has to work as charm but… not…

4.1 configuration 1: Plex pod without host networking, one pod maximum and load balance service. It worked but was unstable

  • Plex detected the pod IP address and when the worker got down, the master run a new Plex instance, which was disconnected from internet…
  • when someone was watching and I just opened the dashboard to see who was he/she, the Plex hanged (disconnected from the internet, all active session was killed, I could not start anything or check anything in the settings)… the PC is working, the pod is working, no error messages in the pod, no CPU or memory activities… just dead. Same happened when I start playing music. CPU is working at 5% load, but Plex got dead
  • If I restart the Plex, my user is showed as anonymous in the dashboard;

4.2 configuration 2: I found that the Plex configuration should be host network, so I changed it yesterday. I restarted the container and the database got corrupted. I spent 4 hours to dump it and restored it… probably… After that Plex works even more unstable. Now every stopped media stays in the dashboard. It should show only active ones

  1. Bask to Docker (Podman actually). My current OS is RHEL 8. podman cri-o and kubernetes installed. This morning, after several killed remote sessions, restarts of pods, reconnecting, relogging etc. I moved the Plex back on the podman but the database is still on the NAS. Dashboard shows several stopped media. The musc is playing but I expect it to be killed any moment if any of my family connects Plex to watch…

Please tell me it is possible to run Plex on kubernetes and where the main problem is?

  • the network location of database?
  • kubernetes or Linux issues?

I could replicate the database on the local hard drives, but I won’t do it. My current database is 9GB and contains 90k files in 90k folders. Database synchronising between different nodes would be a nightmare .

Is there a easy solution for fixing my database, so every stopped movie is not showed on the dashboard?
Can you give me any advice how I can setup my servers so Plex works as expected?

My apologies! I didn’t mean to create so big post but I’m desperate. I hope my Plex setup is clear, All configurations are as described in the documentation…

I think this may be your problem. Media storage is fine via NFS, but the plex database does not work well at all over networked protocols.

Most databases will die a gruesome death over a home nfs setup. At work where you have storage only switches with redundant pathways, maybe. Better would be ISCSI, but you still need redundant pathways.

Some info on placing the Plex database on a network share:

You can also search the forum for kubernetes. You’ll find many hits.

Ex:

If I may cut to the chase?

Plex is designed to run in a SMP environment with its database stored on block level I/O devices.

Kubernetes creates an ASMP processing environment without distributed block level I/O for the main database.

As such, file locking is not guaranteed in a network file sharing environment.
At some point, the different processes will attempt to access the same record(s) of the database. One will get valid data, one won’t. The environment will begin to corrupt itself until it ultimately reaches the point of failure.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.