Closed jattind closed 1 year ago
Hello, RTSP has multiple subprotocols, and the default one (UDP) doesn't work when there's a NAT/firewall between server and clients. A Kubernetes service acts as a NAT between the server pod and the clients, since it has a dedicated IP.
Set TCP as the default transport protocol:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rtsp-server
namespace: bare
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
io.kompose.service: rtsp-server
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
io.kompose.network/edge-bare-edge-network: "true"
io.kompose.service: rtsp-server
spec:
containers:
- image: harbor10165.senode.dev/sgs/simple-rtsp-server
imagePullPolicy: IfNotPresent
name: rtsp-server
ports:
- containerPort: 8554
protocol: TCP
resources:
limits:
cpu: "1"
memory: "1073741824"
env:
- name: MTX_PROTOCOLS
value: tcp
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
Alternatively you can replace the Deployment with a StatefulSet, make the service Headless and publish to rtsp-server-0.rtsp-service-tcp
. In this way, the service doesn't perform any load balancing, doesn't act as NAT and you can use UDP.
I tried forcing TCP connection only as per above using the latest release of rtsp-simple-server. It fails to create create a connection:
kubectl logs -f -n bare rtsp-server-5898dcfd5f-8pgwl
2023/06/05 17:20:43 INF MediaMTX / rtsp-simple-server v0.23.4
2023/06/05 17:20:43 INF [RTSP] listener opened on :8554 (TCP)
2023/06/05 17:20:43 INF [RTMP] listener opened on :1935
2023/06/05 17:20:43 INF [HLS] listener opened on :8888
2023/06/05 17:20:43 INF [WebRTC] listener opened on :8889 (HTTP)
2023/06/05 17:21:47 INF [RTSP] [conn 10.42.172.122:45392] opened
2023/06/05 17:21:47 INF [RTSP] [session 7f83351b] created by 10.42.172.122:45392
2023/06/05 17:21:47 INF [RTSP] [conn 10.42.172.122:45392] closed (EOF)
2023/06/05 17:21:47 INF [RTSP] [session 7f83351b] destroyed (not in use)
In order to debug what's happening, please post logs of the TCP-based connection with the parameter logLevel: debug
.
This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.
Which version are you using?
v0.21.6
Which operating system are you using?
Describe the issue
Deployed rtsp-simple-server in a kubernetes cluster. If I use the pod IP to send a stream, the connection remains established, but if I create a service for the pod and try to connect a client, the connection gets established, but immediately terminates.
Describe how to replicate the issue
Deploy the server using a yaml file as shown bellow kubectl apply -f rtsp-server-deployment.yaml kubectl apply -f rtsp-service.yaml try connecting an rtsp stream to the rts-simple-server View the logs for the POD kubectl logs -n bare srtp-pod
Did you attach the server logs?
yes
Did you attach a network dump?
no