postgres
by CloudPirates
The World's Most Advanced Open Source Relational Database
About this chart
PostgreSQL
A Helm chart for PostgreSQL - The World's Most Advanced Open Source Relational Database. PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
Prerequisites
- Kubernetes 1.24+
- Helm 3.2.0+
- PV provisioner support in the underlying infrastructure (if persistence is enabled)
Installing the Chart
To install the chart with the release name my-postgres:
helm install my-postgres oci://registry-1.docker.io/cloudpirates/postgres
To install with custom values:
helm install my-postgres oci://registry-1.docker.io/cloudpirates/postgres -f my-values.yaml
Or install directly from the local chart:
helm install my-postgres ./charts/postgres
The command deploys PostgreSQL on the Kubernetes cluster in the default configuration. The Configuration section lists the parameters that can be configured during installation.
Uninstalling the Chart
To uninstall/delete the my-postgres deployment:
helm uninstall my-postgres
The command removes all the Kubernetes components associated with the chart and deletes the release.
Security & Signature Verification
This Helm chart is cryptographically signed with Cosign to ensure authenticity and prevent tampering.
Public Key:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5U+rM2d3hDjgP5T3cLShuuQIU9vR
Z4/G+Nug6q5vRa+C3qUA1wXjbaJFAfcIrv5VjmYAYOj13shnPpp3Zh4fnQ==
-----END PUBLIC KEY-----
To verify the helm chart before installation, copy the public key to the file cosign.pub and run cosign:
cosign verify --key cosign.pub registry-1.docker.io/cloudpirates/postgres:<version>
Configuration
The following table lists the configurable parameters of the PostgreSQL chart and their default values.
Global parameters
| Parameter | Description | Default |
|---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
global.enableServiceLinks | Enable service links in pods | true |
PostgreSQL image configuration
| Parameter | Description | Default |
|---|---|---|
image.registry | PostgreSQL image registry | docker.io |
image.repository | PostgreSQL image repository | postgres |
image.tag | PostgreSQL image tag (immutable tags are recommended) | "18.3@sha256:69e8582b781cb44fa4557b98ed586fe68361e320d9b12f9707494335634f4f3d" |
image.imagePullPolicy | PostgreSQL image pull policy | Always |
image.useHardenedImage | Set to true when using hardened images (e.g., DHI) that have different PGDATA paths for Postgres <18 | false |
Deployment configuration
| Parameter | Description | Default |
|---|---|---|
replicaCount | Number of PostgreSQL replicas to deploy (Note: PostgreSQL doesn't support multi-master replication by default) | 1 |
nameOverride | String to partially override postgres.fullname | "" |
fullnameOverride | String to fully override postgres.fullname | "" |
namespaceOverride | String to override the namespace for all resources | "" |
commonLabels | Labels to add to all deployed objects | {} |
commonAnnotations | Annotations to add to all deployed objects | {} |
priorityClassName | Priority class name to be used for the pods | `` |
terminationGracePeriodSeconds | Time for Kubernetes to wait for the pod to gracefully terminate | 30 |
Pod annotations and labels
| Parameter | Description | Default |
|---|---|---|
podAnnotations | Map of annotations to add to the pods | {} |
podLabels | Map of labels to add to the pods | {} |
Security Context
| Parameter | Description | Default |
|---|---|---|
podSecurityContext.fsGroup | Group ID for the volumes of the pod | 999 |
containerSecurityContext.allowPrivilegeEscalation | Enable container privilege escalation | false |
containerSecurityContext.runAsNonRoot | Configure the container to run as a non-root user | true |
containerSecurityContext.runAsUser | User ID for the PostgreSQL container | 999 |
containerSecurityContext.runAsGroup | Group ID for the PostgreSQL container | 999 |
containerSecurityContext.readOnlyRootFilesystem | Mount container root filesystem as read-only | false |
containerSecurityContext.capabilities.drop | Linux capabilities to be dropped | ["ALL"] |
PostgreSQL Authentication
| Parameter | Description | Default |
|---|---|---|
auth.username | PostgreSQL superuser name (POSTGRES_USER). If empty, defaults to postgres. | "" |
auth.password | Password for the PostgreSQL superuser (POSTGRES_PASSWORD). Auto-generated if empty. | "" |
auth.database | Default database to create (POSTGRES_DB). Defaults to the superuser name if empty. | "" |
auth.existingSecret | Name of an existing secret containing the superuser password. When set, the chart does not create its own secret. | "" |
auth.secretKeys.adminPasswordKey | Key in auth.existingSecret that holds the superuser password. | "postgres-password" |
Chart-generated secret
When auth.existingSecret is not set the chart creates a secret named <fullname> (e.g. my-postgres) with the following keys:
| Key | Description |
|---|---|
postgres-password | Superuser password (plain-text encoded) |
host | Service hostname (<fullname>.<namespace>.svc) |
port | Service port |
username | Superuser name |
database | Default database name |
uri | Full postgresql:// connection URI |
When auth.existingSecret is set, none of these keys are generated. Your secret must contain at minimum the key referenced by auth.secretKeys.adminPasswordKey.
PostgreSQL Configuration
| Parameter | Description | Default |
|---|---|---|
config.mountConfigMap | Enable mounting of ConfigMap with PostgreSQL configuration | true |
config.extraConfig | Additional PostgreSQL configuration parameters (list of raw config lines) | [] |
config.existingConfigmap | Name of existing ConfigMap with PostgreSQL configuration | "" |
config.pgHbaConfig | Content of a custom pg_hba.conf file to be used instead of the default config | "" |
config.postgresql.max_connections | Maximum number of connections | 100 |
config.postgresql.shared_buffers | Amount of memory the database server uses for shared memory buffers | 128MB |
config.postgresql.effective_cache_size | Sets the planner's assumption about the total size of the data caches | 4GB |
config.postgresql.work_mem | Amount of memory to be used by internal sort operations and hash tables | 4MB |
config.postgresql.maintenance_work_mem | Maximum amount of memory to be used by maintenance operations | 64MB |
config.postgresql.checkpoint_completion_target | Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval | 0.7 |
config.postgresql.random_page_cost | Sets the planner's estimate of the cost of a non-sequentially-fetched disk page | 1.1 |
config.postgresql.timezone | Default timezone setting | UTC |
config.postgresql.locale | Locale setting for all lc_* settings | en_US.utf8 |
config.postgresql.default_text_search_config | Sets default text search configuration | pg_catalog.english |
config.postgresql.datestyle | Sets the display format for date and time values | iso, mdy |
config.postgresql.log_destination | Sets the destination for server log output | stderr |
config.postgresql.logging_collector | Start a subprocess to capture stderr output into log files | off |
config.postgresql.log_min_messages | Sets the message levels that are logged | warning |
config.postgresql.log_min_error_statement | Causes all statements generating error at or above this level to be logged | error |
config.postgresql.log_statement | Sets the type of statements logged | none |
config.postgresql.log_min_duration_statement | Sets the minimum execution time above which all statements will be logged | -1 |
config.postgresql.shared_preload_libraries | Shared preload libraries (comma-separated list) | "" |
config.postgresql.wal_buffers | Amount of memory used in shared memory for WAL data | 16MB |
config.postgresql.wal_level | Determines how much information is written to the WAL | replica |
config.postgresql.max_wal_senders | Maximum number of concurrent connections from standby servers | 5 |
| `co |
Deploy postgres with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has postgres 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 chartpostgres is pinned at v0.22.1 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