apiVersion: apps/v1 kind: Deployment metadata: namespace: dev-1 name: postgres-testbalance labels: app: postgres-testbalance spec: replicas: 1 selector: matchLabels: app: postgres-testbalance template: metadata: labels: app: postgres-testbalance spec: containers: - name: postgres-testbalance image: postgres:14.2 ports: - containerPort: 5432 env: - name: POSTGRES_DB valueFrom: secretKeyRef: name: pg-testbalance-secrets key: db - name: POSTGRES_USER valueFrom: secretKeyRef: name: pg-testbalance-secrets key: user - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: pg-testbalance-secrets key: password volumeMounts: - mountPath: "/var/lib/postgresql/data" name: "pgdata-testbalance" subPath: "postgres" volumes: - name: pgdata-testbalance # This AWS EBS volume must already exist. awsElasticBlockStore: volumeID: "vol-040959283a18ed913" fsType: ext4 --- kind: Service apiVersion: v1 metadata: name: postgres-testbalance namespace: dev-1 spec: ports: - name: pgql-testbalance protocol: TCP port: 5432 targetPort: 5432 selector: app: postgres-testbalance