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