apiVersion: apps/v1 kind: Deployment metadata: name: pkgrepo namespace: infra labels: app: pkgrepo 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: pkgrepo template: metadata: labels: app: pkgrepo spec: initContainers: - name: nfs-check-pkgrepo 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: pkgrepo-storage mountPath: /mnt readOnly: true containers: - name: nginx image: nginx:1.27-alpine ports: - containerPort: 8080 # Liveness probe: restart if nginx stops responding livenessProbe: httpGet: path: /healthz port: 8080 periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 3 # Readiness probe: remove from service if not ready readinessProbe: httpGet: path: /healthz port: 8080 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 2 volumeMounts: - name: pkgrepo-storage mountPath: /usr/share/nginx/html readOnly: true - name: nginx-config mountPath: /etc/nginx/nginx.conf subPath: nginx.conf readOnly: true volumes: - name: pkgrepo-storage persistentVolumeClaim: claimName: pkgrepo-pvc - name: nginx-config configMap: name: pkgrepo-nginx-config