ressu / kube-plex

Scalable Plex Media Server on Kubernetes -- dispatch transcode jobs as pods on your cluster!
Apache License 2.0
102 stars 24 forks source link

Media not playing, maybe related to 'allowed without auth' #13

Closed karezza closed 2 years ago

karezza commented 2 years ago

Does this error message indicate that I have not allowed the right IP addresses (from the output at Server->Manage->Console)?

Couldn't find the file to stream: /transcode/Transcode/Sessions/plex-transcode-hdp7bg0whgmnej2wov46x2y5-92653086-2357-4430-95a6-a3fff687c804/init-stream0.m4s,/transcode/Transcode/Sessions/plex-transcode-hdp7bg0whgmnej2wov46x2y5-92653086-2357-4430-95a6-a3fff687c804/chunk-stream0-00001.m4s

I used the following commands and added the two ip ranges:

[travis@ansible]$ kubectl cluster-info dump | grep -m 1 service-cluster-ip-range
                            "--service-cluster-ip-range=10.96.0.0/12",
[~/k/plex]
[travis@ansible]$ kubectl cluster-info dump | grep -m 1 cluster-cidr
                            "--cluster-cidr=172.16.0.0/12",

Seeing things in action:

NAME                                        READY   STATUS    RESTARTS   AGE     IP              NODE        NOMINATED NODE   READINESS GATES
pod/plex-kube-plex-64845789b4-x77t9         1/1     Running   0          10m     172.24.123.74   k-dev-n01   <none>           <none>
pod/pms-elastic-transcoder-gnhpg--1-lb9qk   1/1     Running   0          7m11s   172.24.123.80   k-dev-n01   <none>           <none>
pod/pms-elastic-transcoder-hvjbt--1-7g74w   1/1     Running   0          4m56s   172.24.123.82   k-dev-n01   <none>           <none>

NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                    AGE    SELECTOR
service/plex-kube-plex   ClusterIP   10.103.50.188   <none>        32400/TCP,80/TCP,443/TCP   5h1m   app=kube-plex,release=plex

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS   IMAGES                      SELECTOR
deployment.apps/plex-kube-plex   1/1     1            1           5h1m   plex         plexinc/pms-docker:latest   app=kube-plex,release=plex

NAME                                        DESIRED   CURRENT   READY   AGE    CONTAINERS   IMAGES                      SELECTOR
replicaset.apps/plex-kube-plex-64845789b4   1         1         1       5h1m   plex         plexinc/pms-docker:latest   app=kube-plex,pod-template-hash=64845789b4,release=plex

NAME                                     COMPLETIONS   DURATION   AGE     CONTAINERS   IMAGES                                                                                                 SELECTOR
job.batch/pms-elastic-transcoder-gnhpg   0/1           7m11s      7m13s   plex         docker.io/plexinc/pms-docker@sha256:44a17ea5f1190f366c33310ffb3221c2c58dd0eb9986bab1edbea97d85c037dc   controller-uid=e4bb3366-fb41-47d8-9fba-fd5ce5f9d983
job.batch/pms-elastic-transcoder-hvjbt   0/1           4m55s      4m57s   plex         docker.io/plexinc/pms-docker@sha256:44a17ea5f1190f366c33310ffb3221c2c58dd0eb9986bab1edbea97d85c037dc   controller-uid=caade67f-2902-4f64-8e5a-b70e76fde303
karezza commented 2 years ago

I can exec into the pms* pod and see it is writing to the /transcode folder:

-rw-r--r-- 1 root root  120037 Sep 15 19:29 chunk-stream1-00084.m4s
-rw-r--r-- 1 root root   41339 Sep 15 19:29 chunk-stream1-00085.m4s
-rw-r--r-- 1 root root     804 Sep 15 19:28 init-stream0.m4s
-rw-r--r-- 1 root root     740 Sep 15 19:28 init-stream1.m4s
root@pms-elastic-transcoder-sqvqz--1-qj4fs:/transcode/Transcode/Sessions/plex-transcode-q8qeigtvwinsahkki3e0809g-11bb8219-fc96-47c5-aeab-582de8a29d42#

Yet, there are no files in the /transcode folder on the plex pod:

root@plex-kube-plex:/transcode/Transcode/Sessions/plex-transcode-q8qeigtvwinsahkki3e0809g-11bb8219-fc96-47c5-aeab-582de8a29d42# ls -l
total 0
root@plex-kube-plex:/transcode/Transcode/Sessions/plex-transcode-q8qeigtvwinsahkki3e0809g-11bb8219-fc96-47c5-aeab-582de8a29d42#

In examining each pod I see in the volumes section that both 'shared' and 'transcode' is an 'emptyDir', this expected?

"volumes": [
            {
                "emptyDir": {},
                "name": "shared"
            },
            {
                "name": "data",
                "persistentVolumeClaim": {
                    "claimName": "plex"
                }
            },
            {
                "emptyDir": {},
                "name": "transcode"
            },

I installed telnet on the pms-elastic pod and tested the host/port combinations I see when I run 'ps ax'. Looks like I can reach the specified server/port combinations.

root@pms-elastic-transcoder-4sz7s--1-bvdzc:/transcode/Transcode/Sessions/plex-transcode-2gqqirgh41v7w743kp1ksh1y-dfd41580-b3f8-4335-b65f-dd7295912ddb# ps ax
    PID TTY      STAT   TIME COMMAND
      1 ?        Ssl    0:00 /shared/transcode-launcher --pms-addr=plex-kube-plex:32400 --listen=:32400 --codec-server-url=http://172.24.123.87:39069/ --codec
     10 ?        S      0:00 /usr/lib/plexmediaserver/Plex Transcoder -codec:0 h264 -ss 0 -noaccurate_seek -analyzeduration 20000000 -probesize 20000000 -i /d
     12 pts/0    Ss     0:00 /bin/bash
    371 pts/0    R+     0:00 ps ax
root@pms-elastic-transcoder-4sz7s--1-bvdzc:/transcode/Transcode/Sessions/plex-transcode-2gqqirgh41v7w743kp1ksh1y-dfd41580-b3f8-4335-b65f-dd7295912ddb# telnet plex-kube-plex 32400
Trying 10.103.42.86...
Connected to plex-kube-plex.plex.svc.cluster.local.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@pms-elastic-transcoder-4sz7s--1-bvdzc:/transcode/Transcode/Sessions/plex-transcode-2gqqirgh41v7w743kp1ksh1y-dfd41580-b3f8-4335-b65f-dd7295912ddb# telnet 172.24.123.87 39069
Trying 172.24.123.87...
Connected to 172.24.123.87.
Escape character is '^]'.
karezza commented 2 years ago

I thought I may have found the answer with this in the values.yaml (see below), but after uncommenting and reinstalling, still same result.

  # Mounts which should be carried over to kube-plex transcoder. By default only
  # /data and /transcode are cloned to the transcoding pod. A comma separated list.
  #
  #mounts: /data,/transcode
karezza commented 2 years ago

This may be the issue:

https://hub.docker.com/r/plexinc/pms-docker/ (Plex Pass only) After the server has been set up, you should configure the LAN Networks preference to contain the network of your LAN. This instructs the Plex Media Server to treat these IP addresses as part of your LAN when applying bandwidth controls. The syntax is the same as the ALLOWED_NETWORKS below. For example 192.168.1.0/24,172.16.0.0/16 will allow access to the entire 192.168.1.x range and the 172.16.x.x range.

I have not purchased a plex pass.

ressu commented 2 years ago

Do you have your transcode volume set up to be a shared storage? It sounds like it might be an emptyDir or something similar and the contents of the volume doesn't get shared between Plex and the transcoder.

The second issue of the ALLOWED_NETWORKS is something I was thinking about the other day and it should be possible to get rid of that requirement by modifying the traffic flow a bit.

karezza commented 2 years ago

The transcode was just the default, which didn't include creating a transcode pvc. I have experimented with creating one without any luck.

I don't know how to check if the default emptyDir's are shared between the two pods. I would expect that to be the case with everything being default in the helm install, but maybe something is missing in the default setup.

My guess now is the problem is because I haven't yet paid for a plex pass and ALLOWED_NETWORKS is breaking it, so if there is a way to set things up to not require that it would be nice to have. Would certainly simplify the setup to have one less step for folks new to the project.

ressu commented 2 years ago

An emptyDir is never shared between two pods, the way how emptyDir works is that it creates an empty directory for the pod whenever a pod starts and the contents is deleted afterwards. I improved the documentation a bit in #14

Could you take a look to see if those clarifications would improve your experience too?

ohthehugemanatee commented 2 years ago

I had a similar issue but I thought it was that one of the pods (either transcode or "main" plex pod, I don't remember which) wasn't mounting the transcode dir from my NFS service. A quick glance at the helm chart seemed to say that it fails over to an emptydir.

To my understanding, both the "main" plex container and the transcode container should mount /transcode from the same place.

Unfortunately I ran out of time and couldn't debug further at the time. I'll post back here when I get back to it though.

karezza commented 2 years ago

With one more addition:

persistence:
  transcode:
    enabled: true

it worked

ressu commented 2 years ago

Perfect, updated the readme to match with the comments here. Thanks for flagging this!