apiVersion: apps/v1 kind: Deployment metadata: namespace: test-env name: postgres-testenv labels: app: postgres-testenv spec: replicas: 1 selector: matchLabels: app: postgres-testenv template: metadata: labels: app: postgres-testenv spec: containers: - name: postgres-testenv image: postgres:14.2 ports: - containerPort: 5432 env: - name: POSTGRES_DB valueFrom: secretKeyRef: name: pg-secrets-testenv key: db - name: POSTGRES_USER valueFrom: secretKeyRef: name: pg-secrets-testenv key: user - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: pg-secrets-testenv key: password --- kind: Service apiVersion: v1 metadata: name: postgres-testenv namespace: test-env labels: app: postgres-testenv spec: ports: - name: pgql-testenv protocol: TCP port: 5432 targetPort: 5432 selector: app: postgres-testenv