1
0
forked from k-space/kube

frigate: move storage to dedicated nfs share and offload transcoding to separate go2rtc deployment

This commit is contained in:
Erki Aas 2024-10-19 13:51:13 +03:00
parent 2964034cd3
commit da4df6c21d
4 changed files with 124 additions and 46 deletions

View File

@ -49,18 +49,11 @@ data:
default: 30 default: 30
mode: motion mode: motion
go2rtc:
streams:
server_room: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.2:8080/?action=stream#video=h264"
chaos: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.3:8080/?action=stream#video=h264"
cyber: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.8:8080/?action=stream#video=h264"
workshop: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.10:8080/?action=stream#video=h264"
cameras: cameras:
server_room: server_room:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/server_room - path: rtsp://go2rtc:8554/server_room
roles: roles:
- detect - detect
- rtmp - rtmp
@ -68,7 +61,7 @@ data:
chaos: chaos:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/chaos - path: rtsp://go2rtc:8554/chaos
roles: roles:
- detect - detect
- rtmp - rtmp
@ -76,7 +69,7 @@ data:
cyber: cyber:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/cyber - path: rtsp://go2rtc:8554/cyber
roles: roles:
- detect - detect
- rtmp - rtmp
@ -84,7 +77,7 @@ data:
workshop: workshop:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/workshop - path: rtsp://go2rtc:8554/workshop
roles: roles:
- detect - detect
- rtmp - rtmp
@ -108,24 +101,6 @@ spec:
storage: "100Mi" storage: "100Mi"
storageClassName: "frigate-config" storageClassName: "frigate-config"
--- ---
# Source: frigate/templates/media-pvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: frigate-media
labels:
app.kubernetes.io/name: frigate
helm.sh/chart: frigate-7.6.0
app.kubernetes.io/instance: frigate
app.kubernetes.io/managed-by: Helm
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "100Gi"
storageClassName: "frigate-data"
---
# Source: frigate/templates/service.yaml # Source: frigate/templates/service.yaml
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@ -190,7 +165,7 @@ spec:
app.kubernetes.io/name: frigate app.kubernetes.io/name: frigate
app.kubernetes.io/instance: frigate app.kubernetes.io/instance: frigate
annotations: annotations:
checksum/configmap: a133d33879aa679164f4757e66467236f5aa19733c6bbaf2ac3e53e56e9a758b checksum/configmap: 9de9e29d499af45a0e7392032d64d26d8e13e12211971a307f201c97ac91f173
spec: spec:
containers: containers:
- name: frigate - name: frigate
@ -260,7 +235,7 @@ spec:
emptyDir: {} emptyDir: {}
- name: media - name: media
persistentVolumeClaim: persistentVolumeClaim:
claimName: frigate-media claimName: frigate-storage
- name: dshm - name: dshm
emptyDir: emptyDir:
medium: Memory medium: Memory

32
frigate/storage.yml Normal file
View File

@ -0,0 +1,32 @@
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: frigate-storage
spec:
persistentVolumeReclaimPolicy: Retain
capacity:
storage: 1Ti
accessModes:
- ReadWriteMany
storageClassName: ""
nfs:
server: 172.21.0.7
path: /nas/k6/frigate
mountOptions:
- vers=4
- minorversion=1
- noac
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: frigate-storage
spec:
volumeName: frigate-storage
storageClassName: ""
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Ti

80
frigate/transcode.yml Normal file
View File

@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: go2rtc
labels:
app.kubernetes.io/name: go2rtc
app.kubernetes.io/instance: go2rtc
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: go2rtc
app.kubernetes.io/instance: go2rtc
template:
metadata:
labels:
app.kubernetes.io/name: go2rtc
app.kubernetes.io/instance: go2rtc
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- frigate
topologyKey: "kubernetes.io/hostname"
# nodeSelector:
# dedicated: nvr
# tolerations:
# - key: dedicated
# operator: Equal
# value: nvr
# effect: NoSchedule
containers:
- name: go2rtc
image: alexxit/go2rtc
ports:
- name: rtsp
containerPort: 8554
protocol: TCP
- name: api
containerPort: 1984
protocol: TCP
volumeMounts:
- mountPath: /config/go2rtc.yaml
subPath: config.yml
name: config
resources:
{}
volumes:
- name: config
secret:
secretName: go2rtc-config
items:
- key: config.yml
path: config.yml
---
apiVersion: v1
kind: Service
metadata:
name: go2rtc
labels:
app.kubernetes.io/name: go2rtc
app.kubernetes.io/instance: go2rtc
spec:
type: ClusterIP
ipFamilyPolicy: SingleStack
ports:
- name: rtsp
port: 8554
protocol: TCP
targetPort: rtsp
selector:
app.kubernetes.io/name: go2rtc
app.kubernetes.io/instance: go2rtc

View File

@ -87,18 +87,11 @@ config: |
default: 30 default: 30
mode: motion mode: motion
go2rtc:
streams:
server_room: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.2:8080/?action=stream#video=h264"
chaos: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.3:8080/?action=stream#video=h264"
cyber: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.8:8080/?action=stream#video=h264"
workshop: "ffmpeg:http://user:{FRIGATE_RTSP_PASSWORD}@100.102.2.10:8080/?action=stream#video=h264"
cameras: cameras:
server_room: server_room:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/server_room - path: rtsp://go2rtc:8554/server_room
roles: roles:
- detect - detect
- rtmp - rtmp
@ -106,7 +99,7 @@ config: |
chaos: chaos:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/chaos - path: rtsp://go2rtc:8554/chaos
roles: roles:
- detect - detect
- rtmp - rtmp
@ -114,7 +107,7 @@ config: |
cyber: cyber:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/cyber - path: rtsp://go2rtc:8554/cyber
roles: roles:
- detect - detect
- rtmp - rtmp
@ -122,7 +115,7 @@ config: |
workshop: workshop:
ffmpeg: ffmpeg:
inputs: inputs:
- path: rtsp://127.0.0.1:8554/workshop - path: rtsp://go2rtc:8554/workshop
roles: roles:
- detect - detect
- rtmp - rtmp
@ -181,7 +174,5 @@ persistence:
media: media:
enabled: true enabled: true
storageClass: "frigate-data" existingClaim: "frigate-storage"
accessMode: ReadWriteOnce skipuninstall: true
size: 100Gi
skipuninstall: false