{ apiVersion: "apps/v1", kind: "StatefulSet", metadata: { name: "postgres" }, spec: { selector: { matchLabels: { app: "postgres" } }, serviceName: "postgres", template: { metadata:{ labels: { app: "postgres" } }, spec: { containers: [ { name: "postgres", image: "docker.io/postgres:13", ports: [ {containerPort: 5432, name: "db"} ], env: [ { name: "POSTGRES_DB", value: "picc" }, { name: "POSTGRES_PASSWORD", valueFrom: { secretKeyRef: { name: "postgres-password", key: "password" } } } ], volumeMounts: [ { name: "postgres-data", mountPath: "/var/lib/postgresql/data" }, { name: "dbinit", mountPath: "/docker-entrypoint-initdb.d" } ] } ], volumes: [ { name: "dbinit", configMap: { name: "postgres-dbinit" } } ] } }, volumeClaimTemplates : [{ metadata: { name: "postgres-data" }, spec: { accessModes: ["ReadWriteOnce"], resources: { requests: { storage: "100Mi" } } } }] } }