apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  labels:
    app: jira-clone
    tier: database
    service: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jira-clone
      tier: database
      service: postgres
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: jira-clone
        tier: database
        service: postgres
    spec:
      containers:
        - env:
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  key: POSTGRES_DB
                  name: db-config
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: POSTGRES_PASSWORD
                  name: db-config
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  key: POSTGRES_USER
                  name: db-config
          image: postgres:10.6-alpine
          name: postgres-jira-clone
          ports:
            - containerPort: 5432
          resources: {}
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgres-volume
      restartPolicy: Always
      volumes:
        - name: postgres-volume
          persistentVolumeClaim:
            claimName: postgres-volume
status: {}