apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres-statefulset
spec:
  selector:
    matchLabels:
      app: postgres
  serviceName: postgres-service
  replicas: 1
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:14.2
          ports:
            - containerPort: 5432
              name: postgres
          env:
            - name: POSTGRES_PASSWORD
              value: webbde
            - name: POSTGRES_USER
              value: webbde
            - name: POSTGRES_DATABASE
              value: webbde
          volumeMounts:
            - name: postgres-data
              mountPath: /bitnami/postgresql
  volumeClaimTemplates:
    - metadata:
        name: postgres-data
      spec:
        storageClassName: manual
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
