apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:14
          env:
            - name: POSTGRES_DB
              value: data
          envFrom:
            - secretRef:
                name: postgres
          resources: {}
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresql
      restartPolicy: Always
      volumes:
        - name: postgresql
          hostPath:
            path: /var/k8s/volumes/default/postgres
