apiVersion: v1 kind: Service metadata: name: authentik-postgres-service namespace: authentik spec: clusterIP: None selector: app: authentik-postgres ports: - port: 5432 targetPort: 5432 --- apiVersion: apps/v1 kind: StatefulSet metadata: name: authentik-postgres-statefulset namespace: authentik spec: selector: matchLabels: app: authentik-postgres serviceName: authentik-postgres-service replicas: 1 template: metadata: labels: app: authentik-postgres spec: containers: - name: postgres image: docker.io/library/postgres:15-alpine env: - name: POSTGRES_DB value: authentik - name: POSTGRES_USER valueFrom: secretKeyRef: name: authentik-secrets key: AUTHENTIK_POSTGRESQL__USER - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: authentik-secrets key: AUTHENTIK_POSTGRESQL__PASSWORD ports: - containerPort: 5432 name: postgres volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data resources: requests: memory: "256Mi" cpu: "200m" limits: memory: "1Gi" cpu: "500m" volumeClaimTemplates: - metadata: name: postgres-data spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 5Gi