apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: db
  name: db
spec:
  replicas: 1
  selector:
    matchLabels:
      name: db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        name: db
    spec:
      containers:
        - env:
            - name: PGDATA
              value: /var/lib/postgresql/data/pgdata
            - name: POSTGRES_DB
              value: evox
            - name: POSTGRES_PASSWORD
              value: evox
            - name: POSTGRES_SERVER
              value: localhost:5432
            - name: POSTGRES_USER
              value: evox
          image: postgres:13.3
          name: db
          volumeMounts:
            - mountPath: /var/lib/postgresql/data/pgdata
              name: postgres-data
      restartPolicy: Always
      volumes:
        - name: postgres-data
          persistentVolumeClaim:
            claimName: postgres-data
