--- apiVersion: v1 kind: Secret metadata: name: gongme-postgres namespace: gongme type: Opaque stringData: POSTGRES_DB: gongme POSTGRES_USER: gongme POSTGRES_PASSWORD: "gongme-prod-pw-change-me" --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: gongme-postgres-data namespace: gongme spec: accessModes: ["ReadWriteOnce"] storageClassName: longhorn-gongme resources: requests: storage: 5Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: gongme-postgres namespace: gongme spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: gongme-postgres template: metadata: labels: app: gongme-postgres spec: containers: - name: postgres image: postgres:16-alpine ports: - containerPort: 5432 envFrom: - secretRef: name: gongme-postgres env: - name: PGDATA value: /var/lib/postgresql/data/pgdata volumeMounts: - name: data mountPath: /var/lib/postgresql/data startupProbe: exec: command: ["pg_isready", "-U", "gongme", "-d", "gongme"] initialDelaySeconds: 10 periodSeconds: 10 failureThreshold: 30 readinessProbe: exec: command: ["pg_isready", "-U", "gongme", "-d", "gongme"] periodSeconds: 10 livenessProbe: exec: command: ["pg_isready", "-U", "gongme", "-d", "gongme"] periodSeconds: 30 failureThreshold: 5 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi volumes: - name: data persistentVolumeClaim: claimName: gongme-postgres-data --- apiVersion: v1 kind: Service metadata: name: gongme-postgres namespace: gongme spec: selector: app: gongme-postgres ports: - port: 5432 targetPort: 5432