feat: Configure MediaMTX deployment and Nginx Ingress Controller for streaming

This commit is contained in:
capitano
2025-10-12 10:19:03 +02:00
parent f1c7163e6a
commit 0193e6f4b1
2 changed files with 108 additions and 0 deletions

99
gemini-k8s-mediamtx.yaml Normal file
View File

@@ -0,0 +1,99 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mediamtx-deployment
namespace: streaming
spec:
replicas: 1
selector:
matchLabels:
app: mediamtx
template:
metadata:
labels:
app: mediamtx
spec:
containers:
- name: mediamtx-server
image: bluenviron/mediamtx:latest # Immagine ufficiale, non serve buildare nulla!
env:
- name: MTX_RTSPTRANSPORTS
value: "tcp,udp"
- name: MTX_HLSSERVER_ADDRESS
value: ":8888"
- name: MTX_RTMPSERVER_ADDRESS
value: ":1935"
- name: MTX_SRTSERVER_ADDRESS
value: ":8890"
ports:
- containerPort: 8888 # HLS
- containerPort: 1935 # RTMP
- containerPort: 8890 # SRT (TCP)
- containerPort: 8890
protocol: UDP # SRT (UDP)
---
# Servizi interni per raggiungere il pod
apiVersion: v1
kind: Service
metadata:
name: mediamtx-hls-service
namespace: streaming
spec:
type: ClusterIP
selector:
app: mediamtx
ports:
- name: http-hls
port: 8888
targetPort: 8888
---
apiVersion: v1
kind: Service
metadata:
name: mediamtx-rtmp-service
namespace: streaming
spec:
type: ClusterIP
selector:
app: mediamtx
ports:
- name: rtmp
port: 1935
targetPort: 1935
---
apiVersion: v1
kind: Service
metadata:
name: mediamtx-srt-service
namespace: streaming
spec:
type: ClusterIP
selector:
app: mediamtx
ports:
- name: srt
port: 8890
targetPort: 8890
protocol: TCP
---
# Ingress per la distribuzione HLS via HTTP (SSL gestito esternamente)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mediamtx-hls-ingress
namespace: streaming
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTP" # Assicurati che l'Ingress parli HTTP con il servizio HLS
spec:
ingressClassName: nginx
rules:
- host: tv.giaco.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mediamtx-hls-service
port:
name: http-hls