apiVersion: v1 kind: PersistentVolume metadata: name: birbnetes-nfs-output-postgres namespace: birbnetes spec: capacity: storage: 10Gi accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Recycle nfs: server: 192.168.100.3 path: /srv/kubedata/birbnetes/output_postgres --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: output-postgres-pv-claim labels: app: output-postgres namespace: birbnetes spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi --- apiVersion: v1 kind: ConfigMap metadata: name: output-postgres-config labels: app: output-postgres namespace: birbnetes data: POSTGRES_DB: output-service POSTGRES_USER: output-service POSTGRES_PASSWORD: output-service-supersecret PGDATA: /var/lib/postgresql/data/pgdata --- apiVersion: apps/v1 kind: Deployment metadata: name: output-postgres namespace: birbnetes spec: replicas: 1 selector: matchLabels: app: output-postgres template: metadata: labels: app: output-postgres spec: containers: - name: output-postgres image: postgres:12 imagePullPolicy: "IfNotPresent" ports: - containerPort: 5432 envFrom: - configMapRef: name: output-postgres-config volumeMounts: - mountPath: /var/lib/postgresql/data name: output-postgredb volumes: - name: output-postgredb persistentVolumeClaim: claimName: output-postgres-pv-claim --- apiVersion: v1 kind: Service metadata: name: output-postgres namespace: birbnetes spec: type: ClusterIP ports: - port: 5432 targetPort: 5432 protocol: TCP selector: app: output-postgres