1.3 KiB · text History 442a476
# Minimal Postgres for the ircd deployment. For real workloads use a
# managed instance (RDS, Cloud SQL, Crunchy Data) or an operator
# (Zalando, CloudNative-PG); this StatefulSet exists so the example is
# end-to-end runnable.
apiVersion: v1
kind: Service
metadata:
  name: postgres
  namespace: ircd
spec:
  clusterIP: None
  selector:
    app: postgres
  ports:
    - { name: pg, port: 5432, targetPort: 5432 }
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  namespace: ircd
spec:
  serviceName: postgres
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: docker.io/library/postgres:16
          ports:
            - { containerPort: 5432 }
          env:
            - { name: POSTGRES_DB, value: ircd }
            - { name: POSTGRES_USER, value: ircd }
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ircd-secrets
                  key: POSTGRES_PASSWORD
          volumeMounts:
            - { name: data, mountPath: /var/lib/postgresql/data }
  volumeClaimTemplates:
    - metadata: { name: data }
      spec:
        accessModes: [ReadWriteOnce]
        resources:
          requests:
            storage: 10Gi