apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: postgres
  template:
    metadata:
      labels:
        component: postgres
    spec:
      volumes:
        - name: postgres-storage
          persistentVolumeClaim:
            claimName: database-persistent-volume-claim
      containers:
      - name: postgres
        image: danilosilvap/notes-postgres:latest
        ports:
        - containerPort: 5432
        env:
            - name: POSTGRES_PASSWORD
              value: 63eaQB9wtLqmNBpg
            - name: POSTGRES_DB
              value: notesdb
        volumeMounts:
          - name: postgres-storage
            mountPath: /var/lib/postgresql/data
            subPath: postgres
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
