apiVersion: apps/v1
kind: Deployment
metadata:
  name: pgadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pgadmin
  template:
    metadata:
      labels:
        app: pgadmin
    spec:
      containers:
        - name: pgadmin
          image: dpage/pgadmin4:5
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 80 
          envFrom:
            - configMapRef:
                name: pgadmin-config
          env:
          - name: PGADMIN_DEFAULT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: pgadmin-secret
                key: pgadmin-password
          volumeMounts:
            - mountPath: /var/lib/pgadmin
              name: pgadmindb
      volumes:
        - name: pgadmindb
          persistentVolumeClaim:
            claimName: pgadmin-pv-claim