pg-db
by Percona
A Helm chart to deploy the PostgreSQL database with the Percona Operator for PostgreSQL
About this chart
Percona Distribution for PostgreSQL
This chart deploys Percona Distribution for PostgreSQL on Kubernetes controlled by Percona Operator.
Useful links:
Pre-requisites
- Percona Operator for PostgreSQL running in your Kubernetes cluster. See installation details here or in the Operator Documentation.
- Kubernetes 1.32+
- At least
v3.2.3version of helm
Installation
This chart will deploy a PostgreSQL cluster in Kubernetes. It will create a Custom Resource, and the Operator will trigger the creation of corresponding Kubernetes primitives: Deployments, Pods, Secrets, etc. NOTE:
The PG Operator v2 is not directly compatible with old v1 so it is advised to always specify `--version`
when installing pg-operator or pg-db charts to not accidentally cause upgrade to v2 if you were using v1
previously.
Installing the Chart
To install the chart with the pg release name using a dedicated namespace (recommended):
helm repo add percona https://percona.github.io/percona-helm-charts/
helm install my-db percona/pg-db --version 3.1.0 --namespace my-namespace
The chart can be customized using the following configurable parameters:
| Parameter | Description | Default |
|---|---|---|
annotations | The Kubernetes annotations for PerconaPGCluster | `` |
finalizers | Finalizers list | [] |
crVersion | CR Cluster Manifest version | 3.1.0 |
metadata.annotations | The Kubernetes annotations metadata to be set at a global level for all resources created by the Operator | `` |
metadata.labels | The Kubernetes labels metadata to be set at a global level for all resources created by the Operator | `` |
repository | PostgreSQL container image repository | docker.io/percona/percona-distribution-postgresql |
image | Postgres image | docker.io/percona/percona-distribution-postgresql:18.6.1-1 |
imagePullPolicy | image Pull Policy | Always |
imagePullSecrets | Image Pull Secrets | [] |
port | PostgreSQL port | 5432 |
postgresVersion | PostgreSQL container version tag | 18 |
pause | Stop PostgreSQL Database safely | false |
clusterServiceDNSSuffix | The (non-standard) cluster domain to be used as a suffix of the Service safely | "" |
unmanaged | Start cluster and don't manage it (cross cluster replication) | false |
standby.enabled | Switch/start PostgreSQL Database in standby mode | false |
standby.host | Host address of the primary cluster this standby cluster connects to | `` |
standby.port | Port number used by a standby copy to connect to the primary cluster | `` |
standby.repoName | Name of the pgBackRest repository in the primary cluster this standby cluster connects to | `` |
standby.maxAcceptableLag | Maximum WAL lag allowed for the standby cluster, measured in bytes of WAL data | `` |
customRootCATLSSecret.name | Name of the secret with the custom root CA certificate and key for secure connections to the PostgreSQL server | `` |
customRootCATLSSecret.items | Key-value pairs of the key (a key from the secrets.customRootCATLSSecret.name secret) and the path (name on the file system) for the custom root certificate and key | `` |
customTLSSecret.name | A secret with TLS certificate generated for external communications | "" |
customReplicationTLSSecret.name | A secret with TLS certificate generated for internal communications | "" |
tlsOnly | Set to true to force all HBA records to use the hostssl record type. | false |
tls.caValidityDuration | Validity duration for the generated Certificate Authority certificate (e.g. 87600h for 10 years) | `` |
tls.certManagementPolicy | Certificate management policy. auto - the operator creates and maintains TLS secrets. userProvidedOnly - the operator never generates or modifies TLS secrets | auto |
tls.certValidityDuration | Validity duration for the generated leaf TLS certificates (e.g. 2160h for 90 days) | `` |
tls.pgBackRestCertValidityDuration | Validity duration for the generated pgBackRest TLS certificates (e.g. 2160h for 90 days) | `` |
tls.issuerConf.name | Name of the cert-manager Issuer or ClusterIssuer to use for issuing TLS certificates | `` |
tls.issuerConf.kind | Kind of the issuer referenced in tls.issuerConf.name: Issuer or ClusterIssuer | Issuer |
tls.issuerConf.group | API group of the issuer referenced in tls.issuerConf.name | cert-manager.io |
openshift | Set to true if the cluster is being deployed on OpenShift, set to false otherwise, or unset it for autodetection | false |
autoCreateUserSchema | Whether or not the cluster has schemas automatically created for the user defined in spec.users for all of the databases listed for that user. | false |
users.name | The name of the PostgreSQL user | "" |
users.databases | Databases accessible by a specific PostgreSQL user with rights to create objects in them (the option is ignored for postgres user; also, modifying it can’t be used to revoke the already given access) | [] |
users.grantPublicSchemaAccess | This grants the user permission to create tables and update in the public schema of every database they own. | false |
users.options | The ALTER ROLE options other than password (the option is ignored for postgres user) | "" |
users.password.type | The set of characters used for password generation: can be either ASCII (default) or AlphaNumeric | ASCII |
users.secretName | User secret name |
Deploy pg-db with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pg-db on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartpg-db is pinned at v3.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply