apiVersion: apps/v1
kind: Deployment
metadata:
  name: psql
  namespace: psql
spec:
  selector:
    matchLabels:
      app: psql
  replicas: 2
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: psql
    spec:
      containers:
      - image: postgres
        name: psql
        envFrom:
        - configMapRef:
            name: psql-config
        ports:
        - containerPort: 3306
          name: psql
        volumeMounts:
        - name:  storage
          mountPath:  /var/lib/postgresql/data
      volumes:
      - name: storage
        persistentVolumeClaim:
          claimName: psql-pvc
