tmpfs solution for /var/cache/unifi-video on kubernetes
I'm admittedly a kubernetes n00b. I have leveraged a lot of copy/pasted yaml from a buddy to get most of my infrastructure up and running.
I am copy/pasting a working config of another docker container and attempting to get it serving unifi-video.
the tmpfs volume is the current problem - I have tried pointing that voluemount at just a regular directory on my ceph filesystem, as well as setting up a emptyDir on Memory which should operate more like a typical tmpfs, but both have the same error.. log below. Both a ceph volume and a emptyDir result in the "cannot remount tmpfs read-write".
I'm stuck.. any assistance greatly appreciated!
2020-10-22 21:50:12.632135 [info] UMASK defined as '002'. 2020-10-22 21:50:12.676326 [info] PUID defined as '1000' 2020-10-22 21:50:14.234623 [info] PGID defined as '100' 2020-10-22 21:50:14.294305 [info] File perms.txt blocks chown/chmod of videos. mount: /var/cache/unifi-video: cannot remount tmpfs read-write, is write-protected. 2020-10-22 21:50:14.327750 Starting unifi-video... failed. stream closed
I have the exact same issue.
I think it would be helpful to see you config.
It works now for me but with issues:
https://github.com/eugeneccnp/unifi-video-controller
The trick was I had to create the tmpfs on the worker node in advance, I still haven't figured out redundancy but for now I got it to work running off one worker node in a bare metal cluster environment with metallb Layer 2 (ARP) setup, I will keep improving upon this repo as I learn.
Now I need to figure out the recording issue:
1603679386.693 2020-10-26 02:29:46.693/UTC: ERROR [uv.recording.svc] [RecordingService] Free disk space has recovered, disabling emergency shutoff in RecordingService-EmergencyShutOffCheck 1603679356.693 2020-10-26 02:29:16.693/UTC: ERROR [uv.recording.svc] [RecordingService] Unable to do emergency shutoff check, shutting off recordings: Mount point for /var/cache/unifi-video/hls not found in RecordingService-EmergencyShutOffCheck
@mattster98 Have you tried something like this:
volumeMounts:
- name: unifi-video-tmpfs
mountPath: /var/cache/unifi-video
volumes:
- name: unifi-video-tmpfs
emptyDir:
medium: Memory
sizeLimit: "5Gi"
I've got almost the exact same issue with no recordings happening at all and I've been reading this issue and #178.
1635003661.441 2021-10-23 15:41:01.441/GMT: ERROR [uv.recording.svc] [RecordingService] Unable to do emergency shutoff check, shutting off recordings: No such file or directory in RecordingService-EmergencyShutOffCheck
1635003953.204 2021-10-23 15:45:53.204/GMT: ERROR [uv.utils] Unable to get disk usage:/var/lib/unifi-video/videos : No such file or directory in StatsUpdaterTask
I've tried the above suggestion with no luck unfortunately
apiVersion: apps/v1
kind: Deployment
metadata:
name: unifi-video
namespace: unifi
spec:
replicas: 1
selector:
matchLabels:
workload.user.cattle.io/workloadselector: deployment-unifi-unifi-video
strategy:
type: Recreate
template:
metadata:
labels:
workload.user.cattle.io/workloadselector: deployment-unifi-unifi-video
spec:
containers:
- env:
- name: UMASK
value: '002'
- name: PUID
value: '957'
- name: PGID
value: '957'
- name: DEBUG
value: '1'
- name: CREATE_TMPFS
value: 'no'
- name: TZ
value: Americas/Denver
image: pducharme/unifi-video-controller:latest
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 7443
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 2
successThreshold: 1
timeoutSeconds: 2
name: unifi-video
ports:
- containerPort: 10001
name: 10001udp100011
protocol: UDP
- containerPort: 7443
hostPort: 7443
name: 7443tcp74433
protocol: TCP
- containerPort: 7445
name: 7445tcp74453
protocol: TCP
- containerPort: 7446
name: 7446tcp74463
protocol: TCP
- containerPort: 7447
name: 7447tcp74473
protocol: TCP
- containerPort: 7442
name: 7442tcp74423
protocol: TCP
- containerPort: 6666
name: 6666tcp66663
protocol: TCP
- containerPort: 7080
name: 7080tcp70803
protocol: TCP
- containerPort: 1935
name: rtmp
protocol: TCP
- containerPort: 7444
name: rtmps
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 7443
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 2
successThreshold: 2
timeoutSeconds: 2
resources: {}
securityContext:
capabilities:
add:
- DAC_READ_SEARCH
- NET_BIND_SERVICE
- SYS_PTRACE
- SETUID
- SETGID
privileged: true
stdin: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
tty: true
volumeMounts:
- mountPath: /var/lib/unifi-video
name: unifi-video
subPath: data.20211022
- mountPath: /var/lib/unifi-video/videos
name: unifi-video
subPath: videos.20211022
- mountPath: /var/cache/unifi-video
name: unifi-cache
restartPolicy: Always
volumes:
- name: unifi-video
persistentVolumeClaim:
claimName: unifi-video
- name: unifi-cache
emptyDir:
medium: Memory
sizeLimit: "5Gi"
Shelling into the container the related directories /var/cache/unifi-video/hls|export and /var/lib/unifi-video/videos and all there and owned by unifi-video:unifi-video.
@ssteveli I know this is an old post but did you ever find a solution? I'm at the exact same spot as this comment. Trying to run this as a Truenas scale custom-app (kubernetes) and have the EXACT same errors and unable to record.