apiVersion: apps/v1 kind: Deployment metadata: name: navidrome namespace: services spec: replicas: 1 # SQLite DB on RWO PVC: only one writer at a time. Use Recreate so the # old pod releases the DB lock before the new pod starts; otherwise the # new pod blocks indefinitely on the SQLite open. strategy: type: Recreate selector: matchLabels: app: navidrome template: metadata: labels: app: navidrome spec: initContainers: - name: nfs-check-music image: busybox:stable command: - sh - -c - | test -f /mnt/.nfs-sentinel || ( echo "ERROR: NFS sentinel missing at /mnt/.nfs-sentinel" echo "refusing to start; node likely has NFS unmounted" echo "pod would otherwise bind-mount the local-XFS shadow" exit 1 ) volumeMounts: - name: navidrome-music mountPath: /mnt readOnly: true # Pin to r1 so the local-path PVC (which lives on r1's disk at # /var/lib/rancher/k3s/storage) is always reachable. Without this, if # the pod reschedules to a different node it would not find the data # volume and Navidrome would start with an empty DB. nodeSelector: kubernetes.io/hostname: r1.lan.buetow.org containers: - name: navidrome image: deluan/navidrome:0.61.2 imagePullPolicy: IfNotPresent ports: - containerPort: 4533 env: - name: ND_SCANSCHEDULE value: "1h" - name: ND_LOGLEVEL value: "info" - name: ND_BASEURL value: "" startupProbe: httpGet: path: /ping port: 4533 # Allow up to 5 min for cold start (DB open, first scan, etc.) initialDelaySeconds: 15 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 60 readinessProbe: httpGet: path: /ping port: 4533 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 3 livenessProbe: httpGet: path: /ping port: 4533 periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 5 volumeMounts: - name: navidrome-data mountPath: /data - name: navidrome-music mountPath: /music volumes: - name: navidrome-data persistentVolumeClaim: claimName: navidrome-data-pvc - name: navidrome-music persistentVolumeClaim: claimName: navidrome-music-pvc --- apiVersion: v1 kind: Service metadata: labels: app: navidrome name: navidrome-service namespace: services spec: ports: - name: web port: 4533 protocol: TCP targetPort: 4533 selector: app: navidrome