Modularize bridge and improve control GUI
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# Kubernetes Examples
|
||||
|
||||
This directory contains two deployment patterns for one Frigate instance.
|
||||
|
||||
## Same Pod
|
||||
|
||||
`same-pod.yaml` runs Frigate and the bridge as two containers in one Pod:
|
||||
|
||||
- `camera-control` is a real sidecar,
|
||||
- both containers share the Pod network namespace,
|
||||
- `FRIGATE_URL=http://127.0.0.1:5000`,
|
||||
- this is the lowest-latency and simplest option when the bridge lifecycle
|
||||
should follow the Frigate Pod.
|
||||
|
||||
```bash
|
||||
kubectl apply -f examples/kubernetes/same-pod.yaml
|
||||
```
|
||||
|
||||
For an existing Frigate Deployment, copy only the `camera-control` container
|
||||
block into the existing Pod template and keep `FRIGATE_URL` pointed at
|
||||
`http://127.0.0.1:5000`.
|
||||
|
||||
## Two Pods
|
||||
|
||||
`two-pods.yaml` runs Frigate and the bridge as separate Deployments:
|
||||
|
||||
- Frigate is exposed through a Kubernetes Service named `frigate`,
|
||||
- the bridge uses `FRIGATE_URL=http://frigate:5000`,
|
||||
- the bridge has its own lifecycle and can be restarted independently,
|
||||
- this is useful when adding the bridge next to an existing Frigate Deployment.
|
||||
|
||||
```bash
|
||||
kubectl apply -f examples/kubernetes/two-pods.yaml
|
||||
```
|
||||
|
||||
For production, replace image names, storage, device access, resource requests,
|
||||
and secret names with values from your cluster.
|
||||
@@ -0,0 +1,96 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frigate-with-camera-control
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frigate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: frigate
|
||||
spec:
|
||||
containers:
|
||||
- name: frigate
|
||||
image: ghcr.io/blakeblackshear/frigate:stable
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 5000
|
||||
- name: camera-control
|
||||
image: registry.example.local/frigate-camera-control-bridge:1.0
|
||||
env:
|
||||
- name: FRIGATE_NAME
|
||||
value: frigate-main
|
||||
- name: FRIGATE_URL
|
||||
value: http://127.0.0.1:5000
|
||||
- name: MQTT_HOST
|
||||
value: mqtt.default.svc.cluster.local
|
||||
- name: BASE_TOPIC
|
||||
value: frigate_camera_control/frigate-main
|
||||
- name: UI_LANGUAGE
|
||||
value: en
|
||||
- name: FRIGATE_REFRESH_SECONDS
|
||||
value: "300"
|
||||
- name: SNAPSHOT_RETRY_SECONDS
|
||||
value: "600"
|
||||
- name: SNAPSHOT_REFRESH_SECONDS
|
||||
value: "3600"
|
||||
- name: SNAPSHOT_LIVE_ON_GUI
|
||||
value: "true"
|
||||
- name: STARTUP_ALL_OFF
|
||||
value: "true"
|
||||
- name: AUTO_OFF_SIREN_SECONDS
|
||||
value: "180"
|
||||
- name: AUTO_OFF_RED_BLUE_SECONDS
|
||||
value: "300"
|
||||
- name: AUTO_OFF_WHITE_LIGHT_SECONDS
|
||||
value: "600"
|
||||
- name: MQTT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: mqtt-user
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: mqtt-password
|
||||
- name: DEFAULT_CAMERA_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: camera-user
|
||||
- name: DEFAULT_CAMERA_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: camera-password
|
||||
- name: HTTP_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: http-token
|
||||
optional: true
|
||||
ports:
|
||||
- name: control-http
|
||||
containerPort: 5011
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: control-http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: control-http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 30
|
||||
volumeMounts:
|
||||
- name: camera-control-state
|
||||
mountPath: /var/lib/frigate-camera-control-bridge
|
||||
volumes:
|
||||
- name: camera-control-state
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,130 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frigate
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frigate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: frigate
|
||||
spec:
|
||||
containers:
|
||||
- name: frigate
|
||||
image: ghcr.io/blakeblackshear/frigate:stable
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 5000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frigate
|
||||
spec:
|
||||
selector:
|
||||
app: frigate
|
||||
ports:
|
||||
- name: http
|
||||
port: 5000
|
||||
targetPort: http
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frigate-camera-control
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frigate-camera-control
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: frigate-camera-control
|
||||
spec:
|
||||
containers:
|
||||
- name: camera-control
|
||||
image: registry.example.local/frigate-camera-control-bridge:1.0
|
||||
env:
|
||||
- name: FRIGATE_NAME
|
||||
value: frigate-main
|
||||
- name: FRIGATE_URL
|
||||
value: http://frigate:5000
|
||||
- name: MQTT_HOST
|
||||
value: mqtt.default.svc.cluster.local
|
||||
- name: BASE_TOPIC
|
||||
value: frigate_camera_control/frigate-main
|
||||
- name: UI_LANGUAGE
|
||||
value: en
|
||||
- name: FRIGATE_REFRESH_SECONDS
|
||||
value: "300"
|
||||
- name: STARTUP_ALL_OFF
|
||||
value: "true"
|
||||
- name: AUTO_OFF_SIREN_SECONDS
|
||||
value: "180"
|
||||
- name: AUTO_OFF_RED_BLUE_SECONDS
|
||||
value: "300"
|
||||
- name: AUTO_OFF_WHITE_LIGHT_SECONDS
|
||||
value: "600"
|
||||
- name: MQTT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: mqtt-user
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: mqtt-password
|
||||
- name: DEFAULT_CAMERA_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: camera-user
|
||||
- name: DEFAULT_CAMERA_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: camera-password
|
||||
- name: HTTP_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frigate-camera-control
|
||||
key: http-token
|
||||
optional: true
|
||||
ports:
|
||||
- name: control-http
|
||||
containerPort: 5011
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: control-http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: control-http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 30
|
||||
volumeMounts:
|
||||
- name: camera-control-state
|
||||
mountPath: /var/lib/frigate-camera-control-bridge
|
||||
volumes:
|
||||
- name: camera-control-state
|
||||
emptyDir: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frigate-camera-control
|
||||
spec:
|
||||
selector:
|
||||
app: frigate-camera-control
|
||||
ports:
|
||||
- name: control-http
|
||||
port: 5011
|
||||
targetPort: control-http
|
||||
Reference in New Issue
Block a user