apiVersion: apps/v1 kind: Deployment metadata: name: postgresql spec: selector: matchLabels: app: postgresql strategy: type: Recreate template: metadata: labels: app: postgresql spec: containers: - image: postgres:13 name: postgresql env: - name: POSTGRES_USER valueFrom: secretKeyRef: name: postgres-secret key: postgres-user - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: postgres-secret key: postgres-password - name: POSTGRES_DB valueFrom: configMapKeyRef: name: postgres-config key: postgres-db ports: - containerPort: 5432 name: postgresql volumeMounts: - name: postgres-config-volume mountPath: /etc/postgresql/postgresql.conf subPath: postgresql.conf readOnly: true - name: postgre-data-volume mountPath: /var/lib/postgresql/data volumes: - name: postgres-config-volume configMap: name: postgres-config - name: postgre-data-volume persistentVolumeClaim: claimName: postgres-claim