--- apiVersion: v1 kind: Service metadata: name: outline-postgres namespace: outline labels: app: outline-postgres spec: type: ClusterIP selector: app: outline-postgres ports: - name: postgres port: 5432 targetPort: 5432 protocol: TCP --- apiVersion: apps/v1 kind: StatefulSet metadata: name: outline-postgres namespace: outline labels: app: outline-postgres spec: serviceName: outline-postgres replicas: 0 selector: matchLabels: app: outline-postgres template: metadata: labels: app: outline-postgres spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: csi.hetzner.cloud/location operator: In values: - fsn1 containers: - name: postgres image: postgres:16-alpine imagePullPolicy: IfNotPresent ports: - name: postgres containerPort: 5432 protocol: TCP envFrom: - secretRef: name: outline-postgres-credentials env: - name: PGDATA value: /var/lib/postgresql/data/pgdata resources: requests: cpu: 100m memory: 256Mi limits: cpu: 500m memory: 1Gi readinessProbe: exec: command: - /bin/sh - -c - pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 livenessProbe: exec: command: - /bin/sh - -c - pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" initialDelaySeconds: 30 periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 6 volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data subPath: pgdata volumeClaimTemplates: - metadata: name: postgres-data spec: accessModes: - ReadWriteOnce storageClassName: hcloud-volumes-encrypted resources: requests: storage: 10Gi