Skip to content

Deploying PostgreSQL#

PostgreSQL is deployed using the Bitnami PostgreSQL Helm chart, providing a production-ready database for MTO ecosystem components such as Dex or custom tenant workloads.

Prerequisites#

  • The MTO Dependencies Operator is running in your cluster (bundled with MTO).
  • Create a Kubernetes Secret containing database credentials before applying the CR if you want to use auth.existingSecret.

Minimal Example#

The following CR deploys a standalone PostgreSQL instance:

apiVersion: dependencies.tenantoperator.stakater.com/v1alpha1
kind: Postgres
metadata:
  name: postgres
spec:
  architecture: standalone
  auth:
    username: mtoadmin
    password: changeme
    database: mto
  primary:
    persistence:
      size: 8Gi

Note

For production deployments, use auth.existingSecret instead of inline credentials. Create a Secret with keys postgres-password and password before applying the CR.

Common Customizations#

Using an existing Secret for credentials:

spec:
  auth:
    existingSecret: postgres-credentials
    database: mto

Enabling replication with read replicas:

spec:
  architecture: replication
  readReplicas:
    replicaCount: 2
    resources:
      requests:
        cpu: 250m
        memory: 256Mi

Increasing storage and setting resource limits:

spec:
  primary:
    persistence:
      size: 50Gi
    resources:
      requests:
        cpu: 500m
        memory: 512Mi
      limits:
        cpu: "1"
        memory: 1Gi

Verification#

Confirm PostgreSQL is running:

kubectl get pods -l app.kubernetes.io/name=postgresql

Further Reading#