You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
command: ["socat", "-d", "-d", "-v", "udp4-recvfrom:65001,broadcast,fork", "udp4-sendto:192.168.20.20:65001"] # replace 192.168.20.20 with your HD Home Run's ip
title: "Streaming Live TV with Plex and HDHomeRun inside Kubernetes"
2
+
date: "1/29/2025"
3
+
body:
4
+
- section_title: "Background"
5
+
text: "[HDHomeRuns](https://www.silicondust.com/hdhomerun/) are a great way to stream live TV to your home. These are devices produced by Silicon Dust that connect to an OTA antenna (or cable box) and can be connected to clients via USB or Ethernet.
6
+
These can be found used for pretty cheap on eBay, but even their new products are reasonably priced. What piques most folks' interest in these is their ability to integrate with Plex, allowing you to stream live TV directly within Plex clients."
7
+
- text: "In my case, I chose a Ethernet connected HDHomeRun, however this presented a challenge when running Plex inside Kubernetes. HDHomeRun connections are initiated by the client sending a UDP broadcast packet from port 65001.
8
+
This is done to discover the HDHomeRun device. Once the HDHomeRun device is discovered by the client, it will present it as a connection option, as demonstrated in [this official Plex guide](https://support.plex.tv/articles/225877347-live-tv-dvr/).
9
+
While this can easily work within a given network, what if you run your IOT devices in one VLAN, but run Plex in another? Furthermore, what if you are running Plex inside Kubernetes, which uses NAT between the pod networks and the hosts?"
10
+
- section_title: "Solution"
11
+
text: "Thankfully this is where socat (link) can help us. Socat is a versatile utility for bidirectional data transfer between two independent data streams, supporting various protocols like TCP, UDP, pipes, and files.
12
+
As [meckhert on the Unifi forum](https://community.ui.com/questions/Howto-HDHomerun-discovery-on-different-LAN-segment/97db52c6-4add-4ba1-ab0d-27ee6f43db8f) shared, socat can be used to handle the VLAN traversal.
13
+
In our case it can also handle the NATing issues from inside the Kubernetes cluster! By running socat in a sidecar container with Plex, it will be able to receive the broadcast packets Plex sends out, and forward them directly to the HDHomeRun device."
14
+
- text: "An example deployment of this:"
15
+
- code: "plex_with_socat.yaml"
16
+
- text: "Don't forget to setup any firewall rules. I found the following needed to be allowed between my IOT and Kubernetes VLANs:"
17
+
- text: "Allow HDHomeRun Discovery"
18
+
- text: "- Protocol: IPv4 UDP"
19
+
- text: "- Source: Kubernetes Host IPs"
20
+
- text: "- Destination: HDHomeRun IP"
21
+
- text: "- Destination port: 65001"
22
+
- text: "Allow HDHomeRun streaming"
23
+
- text: "- Protocol: IPv4 TCP"
24
+
- text: "- Source: Kubernetes Host IPs"
25
+
- text: "- Destination: HDHomeRun IP"
26
+
- text: "- Destination Ports: 80, 5004"
27
+
- text: "Hopefully by sharing this I can help someone else who runs into this case. Happy streaming!"
0 commit comments