Persistent template

PostgreSQL

A single PostgreSQL server in your project, deployed from the postgresql-persistent template. Data lives on a persistent volume; you operate the database.

  • Persistent volume for data
  • Credentials in a Secret
  • Single instance
  • Cluster-internal by default

No credit card required · Free during the Alpha phase · View pricing

PostgreSQL · postgresql-persistent templatePLATFORM STACKYour databaseSchema · users · backups · upgradesYOU OPERATETemplate objectsSecret · Service · single-replica workloadYOU OPERATEPersistent volumePVC from the default storage classYOU OPERATEKubernetes platformOKD/OpenShift · dynamic provisioningGRN-MANAGEDHosts & storageNetherlands · 100% renewableGRN-MANAGED GRN.CLOUD

Overview

A relational database for applications in the same project.

Relational storage

PostgreSQL for transactional workloads — SQL, JSONB, full-text search and the extensions shipped in the image.

Dev, test and small production

One server per template instance. Suited to development, CI, test environments and workloads that tolerate a restart.

You operate it

You own backups, upgrades and tuning. For PostgreSQL operated by the platform, with replication and failover, see Databases.

Deployment

An OpenShift template: one set of parameters, processed into the objects below.

Template

postgresql-persistent plus your parameters

Secret

User, password, database name

PersistentVolumeClaim

Sized by VOLUME_CAPACITY, mounted as the data directory

Server + Service

One pod, Recreate strategy, port 5432

  • Web console — Add → Database → PostgreSQL. Choose the persistent template, set the volume size and database name; leave user and password empty to have them generated.
  • CLI — oc new-app --template=postgresql-persistent with -p parameters. List every parameter with oc process --parameters.
  • Use the persistent template. The postgresql-ephemeral variant keeps data in the pod's filesystem and loses it on every restart.
  • Single writer — the volume is mounted by one pod at a time, so the server is recreated, not rolled, on change. Expect a short interruption on restart or redeploy.
bash — oc
# see the template's parameters
$ oc process --parameters postgresql-persistent -n openshift

# deploy with a 10 GiB data volume
$ oc new-app --template=postgresql-persistent \
    -p DATABASE_SERVICE_NAME=postgresql \
    -p POSTGRESQL_DATABASE=app \
    -p VOLUME_CAPACITY=10Gi

# open a psql session in the pod
$ oc rsh deployment/postgresql psql

Lifecycle

What the template does not do for you.

  • Backups — not automated. Schedule pg_dump, run through oc exec or a CronJob, and store the dumps outside the database's own volume.
  • Upgrades — the server version follows the image tag set by POSTGRESQL_VERSION. A major-version change needs a migration of the data directory: dump and restore, or the image's POSTGRESQL_UPGRADE mode for a step from the previous major version. Take a dump first.
  • Availability — one instance, no streaming replication or automatic failover. If the workload needs either, use the managed PostgreSQL service.
  • Capacity — grow the volume by editing the PVC's requested size; set CPU and memory limits with MEMORY_LIMIT or on the workload.

Platform integration

Standard Kubernetes objects in your own project.

  • Block storage — the PVC is provisioned from the cluster's default storage class.
  • Connections — applications in the project connect to postgresql:5432 (the DATABASE_SERVICE_NAME). No Route is created, so the database is not reachable from outside the cluster.
  • Secrets — inject the generated credentials into your application with oc set env --from=secret/postgresql instead of copying them.
  • Pairs with — Keycloak, which needs an external database, and Node.js applications in the same project.

Deploy PostgreSQL with a persistent volume.

From the console's database catalogue, or with oc new-app --template=postgresql-persistent.

Hosted in the Netherlands · EU data residency · 100% renewable energy