Pod in Kubernetes can not establish a RTSP session, UDP port unreachable

9/5/2020

I am trying to make a connection between my pod and a camera through RTSP (using ffmpeg).

My container, when running locally and in the server can establish the connection.

However, in Kubernetes, looks to be able to reach and identify the camera server, but it can not initialize a stream. I did a tcpdump on my container when trying to connect and I received the following:

10:55:37.065954 IP **CAMERA_SERVER_IP** > **POD_NAME**: ICMP **CAMERA_SERVER_IP** udp port 36337 unreachable, length 44

10:55:37.066003 IP **CAMERA_SERVER_IP** > **POD_NAME**: ICMP **CAMERA_SERVER_IP** udp port 36336 unreachable, length 48

**CAMERA_SERVER_IP** -> is the camera server IP addresss

**POD_NAME** -> is my pod's name in kubernetes.

When I try locally, the first UDP port fails too, but the second can establish a connection and stream.

I think this has something to do with port communication, but I am bit lost in what I should try or test.

Thanks!

UPDATE*

Actually I found something strange.

I tried again to start the connection and I analyzed the logs from tcpdump and netstat -tulpn.

When connecting locally, netstat identified the creation of two UDP connections. And tcpdump showed ffmpeg was trying to reach a connection from the server using the same UDP ports from netstat

However, in a pod in Kubernetes, the ports opened on netstat were different from the ports that ffmpeg tried a connection (verified using tcpdump).

I think this is the error, as ffmpeg immediately fails when trying to access a port that is not opened.

-- Raphael Mazzine
ffmpeg
kubernetes
kubernetes-networking
kubernetes-networkpolicy
rtsp

1 Answer

9/7/2020

I actually made a work around using another ffmpeg server wrapper as I explained here: https://github.com/kubernetes/kubernetes/issues/94561

If someone has a similar problem, specially with Intelbras DVR or those that use DAHUA API, this might be interesting to read.

-- Raphael Mazzine
Source: StackOverflow