apiVersion: apps/v1 kind: Deployment metadata: name: postgres spec: replicas: 1 selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - name: postgres image: postgres imagePullPolicy: "IfNotPresent" ports: - containerPort: 5432 envFrom: - secretRef: name: postgres-secret volumeMounts: - mountPath: /var/lib/postgresql/data name: postgredb volumes: - name: postgredb persistentVolumeClaim: claimName: postgres-pv-claim --- apiVersion: v1 kind: Service metadata: name: postgres-service spec: ports: - protocol: TCP port: 5432 targetPort: 5432 selector: app: postgres