apiVersion: apps/v1 kind: Deployment metadata: name: koreader-sync-server spec: replicas: 1 # Recreate so the old pod fully terminates before the new one starts — # avoids NFS-lock races on the hostPath-backed PVC during rolling updates. strategy: type: Recreate selector: matchLabels: app: koreader-sync-server template: metadata: labels: app: koreader-sync-server spec: initContainers: - name: nfs-check-data 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: data mountPath: /mnt readOnly: true containers: - name: koreader-sync-server image: koreader/kosync:latest ports: - containerPort: 17200 volumeMounts: - name: data mountPath: /var/lib/redis volumes: - name: data persistentVolumeClaim: claimName: koreader-sync-server-data