This repository was archived by the owner on May 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
BKM: RTP Streaming under Kubernetes
xwu2 edited this page Dec 6, 2019
·
5 revisions
RTP streaming (from an IP camera) requires to open multiple UDP ports. This presents challenge under Kubernetes, where a service must explicitly declare any open ports (one at a time as of v1.16.) To make things worse, if the container instance is replicated (say in a Deployment
), each container instance must operate at different ranges of UDP ports to avoid port conflict on the same node.
Under Kubernetes, a UDP port can be defined in multiple ways:
We can declare a UDP port directly at the POD level:
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 1
template:
spec:
containers:
- ports:
- containerPort:
protocol: UDP
hostPort: 32546
Instead of exposing port at the POD level, we can also declare the port at Service
:
apiVersion: v1
kind: Service
spec:
ports:
- port: 32546
protocol: UDP
There are drawbacks with the above approaches:
-
Multiple Ports: As of Kubernetes v1.16, there is no support to declare a range of ports. With RTP, we need to open multiple UDP ports (each serving a video or audio stream.) We can workaround this issue utilizing
m4
to generate the configuration:
apiVersion: v1
kind: Service
spec:
ports:
forloop(`PORT',32546,32550,`dnl
- port: defn(`PORT')
protocol: UDP
name: `udp'defn(`PORT')
')dnl
See Also: forloop
TODO
Powered by Open Visual Cloud media and analytics software stacks.