Skip to content

Conversation

@keeneisgood
Copy link
Contributor

@keeneisgood keeneisgood commented Nov 1, 2025

Description

This Pull Request adds the ability to run the Plex Media Server Pod in the host's network namespace when using the Plex helm chart.

This is often necessary for specific networking requirements, such as enabling simple local network discovery and bypassing complex service object configurations by directly using the host's IP.

Changes

  • Added support for setting hostNetWork
  • Added support for changing dnsPolicy

Tests

  • Confirmed default-off, enable-on, and successful host port binding.
# Verify defaults don't set hostNetwork
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ helm upgrade --install plex ./ --namespace plex-test --create-namespace --dry-run | grep -i host

# Verify hostNetwork is set
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ helm upgrade --install plex ./ --namespace plex-test2 --create-namespace --dry-run --set hostNetwork=true | grep -i host
      hostNetwork: true

# Install latest chart
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ export PLEX_VERSION="1.1.3"
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ helm upgrade --install plex plex/plex-media-server --namespace plex-test --create-namespace --version $PLEX_VERSION
Release "plex" does not exist. Installing it now.
NAME: plex
LAST DEPLOYED: Tue Nov  4 09:06:49 2025
NAMESPACE: plex-test
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing plex-media-server.

Your release is named plex.

To learn more about the release, try:

  $ helm status plex
  $ helm get all plex


Mount path for remote is available at 
You can use this as a volume within your other pods to view the file system for your remote.

keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ kubectl get pods -n plex-test
NAME                       READY   STATUS    RESTARTS   AGE
plex-plex-media-server-0   1/1     Running   0          28s

# Install these changes
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ helm upgrade --install plex ./ --namespace plex-test --create-namespace  
Release "plex" has been upgraded. Happy Helming!
NAME: plex
LAST DEPLOYED: Tue Nov  4 09:11:01 2025
NAMESPACE: plex-test
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Thank you for installing plex-media-server.

Your release is named plex.

To learn more about the release, try:

  $ helm status plex
  $ helm get all plex


Mount path for remote is available at 
You can use this as a volume within your other pods to view the file system for your remote.
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ kubectl get pods -n plex-test
NAME                       READY   STATUS    RESTARTS   AGE
plex-plex-media-server-0   1/1     Running   0          4m15s

# Enable hostNetwork
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ helm upgrade --install plex ./ --namespace plex-test --create-namespace  --set hostNetwork=true
Release "plex" has been upgraded. Happy Helming!
NAME: plex
LAST DEPLOYED: Tue Nov  4 09:12:13 2025
NAMESPACE: plex-test
STATUS: deployed
REVISION: 3
TEST SUITE: None
NOTES:
Thank you for installing plex-media-server.

Your release is named plex.

To learn more about the release, try:

  $ helm status plex
  $ helm get all plex


Mount path for remote is available at 
You can use this as a volume within your other pods to view the file system for your remote.

keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ kubectl get pods -n plex-test
NAME                       READY   STATUS    RESTARTS   AGE
plex-plex-media-server-0   1/1     Running   0          69s
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ kubectl describe pod/plex-plex-media-server-0 -n plex-test
Name:             plex-plex-media-server-0
Namespace:        plex-test
Priority:         0
Service Account:  plex-plex-media-server
Node:             k3s-box/192.168.1.191
Start Time:       Tue, 04 Nov 2025 09:13:15 +1000
Labels:           app=plex-media-server
                  app.kubernetes.io/instance=plex
                  app.kubernetes.io/managed-by=Helm
                  app.kubernetes.io/name=plex-media-server
                  app.kubernetes.io/version=1.42.2
                  apps.kubernetes.io/pod-index=0
                  controller-revision-hash=plex-plex-media-server-7d7cc49b84
                  helm.sh/chart=plex-media-server-1.1.3
                  statefulset.kubernetes.io/pod-name=plex-plex-media-server-0
Annotations:      <none>
Status:           Running
IP:               192.168.1.191
IPs:
  IP:           192.168.1.191
Controlled By:  StatefulSet/plex-plex-media-server
Containers:
  plex-plex-media-server-pms:
    Container ID:   containerd://428fa166da567122108abd99ee846e397e177eba0f888164b6d86558760e3832
    Image:          index.docker.io/plexinc/pms-docker:1.42.2.10156-f737b826c
    Image ID:       docker.io/plexinc/pms-docker@sha256:9c03c26b9479ba9a09935f3367459bfdc8d21545f42ed2a13258983c5be1b252
    Port:           32400/TCP
    Host Port:      32400/TCP
    State:          Running
      Started:      Tue, 04 Nov 2025 09:13:16 +1000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /config from pms-config (rw)
      /transcode from pms-transcode (rw)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True 
  Initialized                 True 
  Ready                       True 
  ContainersReady             True 
  PodScheduled                True 
Volumes:
  pms-config:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  pms-config-plex-plex-media-server-0
    ReadOnly:   false
  pms-transcode:
    Type:        EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:      
    SizeLimit:   <unset>
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  88s   default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.
  Normal   Scheduled         36s   default-scheduler  Successfully assigned plex-test/plex-plex-media-server-0 to k3s-box
  Normal   Pulled            35s   kubelet            Container image "index.docker.io/plexinc/pms-docker:1.42.2.10156-f737b826c" already present on machine
  Normal   Created           35s   kubelet            Created container plex-plex-media-server-pms
  Normal   Started           35s   kubelet            Started container plex-plex-media-server-pms

# Test with curl
keene@k3s-box:~/code/github/pms-docker/charts/plex-media-server$ curl http://localhost:32400/web/index.html
<!DOCTYPE html>
<!--
   =======   ==
  /==////== /==
  /==   /== /==   =====   ==   ==
  /=======  /==  ==///== //== ==
  /==////   /== /=======  //===
  /==       /== /==////    ==/==
  /==       /== //======  == //==
  //        //   /////   //   //

@keeneisgood keeneisgood requested a review from a team as a code owner November 1, 2025 08:05
@keeneisgood keeneisgood changed the title feat: Add optional hostNetwork support for Pods feat: Add optional hostNetwork support for Pods to the helm chart Nov 1, 2025
@cilindrox cilindrox self-assigned this Nov 3, 2025
Copy link
Member

@cilindrox cilindrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @keeneisgood - some small comments regarding the value structure, looking forward to adding this feature.

@cilindrox
Copy link
Member

Some more thoughts - folks running hostNetwork: true might also want/benefit from a configurable dnsPolicy parameter, which we currently don't support - we might want to add dnsPolicy: ClusterFirst as the default, with a comment mentioning ClusterFirstWithHostNet when enabling host net. Thoughts @keeneisgood ?

@keeneisgood
Copy link
Contributor Author

keeneisgood commented Nov 3, 2025

Some more thoughts - folks running hostNetwork: true might also want/benefit from a configurable dnsPolicy parameter, which we currently don't support - we might want to add dnsPolicy: ClusterFirst as the default, with a comment mentioning ClusterFirstWithHostNet when enabling host net. Thoughts @keeneisgood ?

@cilindrox

Good idea.

I've added dnsPolicy to these changes and retested:

  • I reviewed some other helm charts and they have added dnsPolicy so this seems the correct thing to do
  • On my home lab I just have to set hostNetwork:true and everything works. That's not to say some people may need to use dnsPolicy and set to ClusterFirstWithHostNet I should probably set it on my deployment at home just to be safe.

Let me know if you are happy with all the comments etc. I tried to keep everything consistent.

Copy link
Member

@cilindrox cilindrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @keeneisgood

@cilindrox cilindrox force-pushed the kmb-add-hostnetwork branch from 01cd506 to d3a71cb Compare November 4, 2025 14:53
@cilindrox cilindrox merged commit 15c47b5 into plexinc:master Nov 4, 2025
2 checks passed
@cilindrox
Copy link
Member

Thanks @keeneisgood ! this should ship as v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants