apiVersion: apps/v1 kind: Deployment metadata: name: ychat namespace: services spec: replicas: 1 # Recreate: single-instance stateful-in-memory chat; avoid two pods racing # for the same Service while the old one drains its sessions. strategy: type: Recreate selector: matchLabels: app: ychat template: metadata: labels: app: ychat 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 securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 fsGroup: 1000 containers: - name: ychat # SQLite is now mandatory (see ychat/DOCKER.md); the image tag tracks # the ychat repo commit that build was cut from. image: registry.lan.buetow.org:30001/ychat:8f3051b imagePullPolicy: IfNotPresent securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 ports: - containerPort: 2000 name: http # No liveness/readiness probes: yChat segfaults on an empty TCP # open+close (a TCP-socket probe would kill it). It serves real HTTP # requests fine, and kubelet restarts the pod if the process exits. resources: requests: memory: 32Mi cpu: 25m limits: memory: 128Mi cpu: 250m volumeMounts: - name: log mountPath: /app/log - name: tmp mountPath: /tmp - name: data mountPath: /app/data volumes: - name: log emptyDir: {} - name: tmp emptyDir: {} - name: data persistentVolumeClaim: claimName: ychat-data-pvc