apiVersion: apps/v1 kind: StatefulSet metadata: name: postgres spec: replicas: 1 serviceName: postgres selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - name: postgres image: postgres:15.2 env: - name: POSTGRES_USER valueFrom: configMapKeyRef: name: restserver-config key: DOCSPELL_SERVER_BACKEND_JDBC_USER - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: restserver-secrets key: DOCSPELL_SERVER_BACKEND_JDBC_PASSWORD - name: POSTGRES_DB value: dbname ports: - name: postgres containerPort: 5432 volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data volumeClaimTemplates: - metadata: name: postgres-data spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 1Gi --- apiVersion: v1 kind: Service metadata: name: postgres spec: selector: app: postgres ports: - name: postgres port: 5432 targetPort: postgres clusterIP: None