apiVersion: apps/v1 kind: Deployment metadata: name: postgres spec: strategy: rollingUpdate: maxSurge: 0 selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - name: postgres image: postgresql-placeholder env: - name: PGDATA value: /var/lib/postgresql/data/pgdata - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: key: DB_PASS name: database - name: POSTGRES_USER valueFrom: secretKeyRef: key: DB_USER name: database - name: POSTGRES_DB value: librephotos livenessProbe: exec: command: - pg_isready - -h - localhost - -U - librephotos ports: - containerPort: 5432 name: psql volumeMounts: - mountPath: /var/lib/postgresql/data name: data securityContext: runAsUser: 999 runAsGroup: 999 fsGroup: 999 volumes: - name: data persistentVolumeClaim: claimName: postgres --- apiVersion: v1 kind: Service metadata: name: postgres spec: ports: - port: 5432 name: psql selector: app: postgres