postgres

by CloudPirates

Helm chartv0.22.1App 18.7.0Apache-2.0Verified publisher

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

ParameterDescriptionDefault
global.imageRegistryGlobal Docker image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]
global.enableServiceLinksEnable service links in podstrue

PostgreSQL image configuration

ParameterDescriptionDefault
image.registryPostgreSQL image registrydocker.io
image.repositoryPostgreSQL image repositorypostgres
image.tagPostgreSQL image tag (immutable tags are recommended)"18.3@sha256:69e8582b781cb44fa4557b98ed586fe68361e320d9b12f9707494335634f4f3d"
image.imagePullPolicyPostgreSQL image pull policyAlways
image.useHardenedImageSet to true when using hardened images (e.g., DHI) that have different PGDATA paths for Postgres <18false

Deployment configuration

ParameterDescriptionDefault
replicaCountNumber of PostgreSQL replicas to deploy (Note: PostgreSQL doesn't support multi-master replication by default)1
nameOverrideString to partially override postgres.fullname""
fullnameOverrideString to fully override postgres.fullname""
namespaceOverrideString to override the namespace for all resources""
commonLabelsLabels to add to all deployed objects{}
commonAnnotationsAnnotations to add to all deployed objects{}
priorityClassNamePriority class name to be used for the pods``
terminationGracePeriodSecondsTime for Kubernetes to wait for the pod to gracefully terminate30

Pod annotations and labels

ParameterDescriptionDefault
podAnnotationsMap of annotations to add to the pods{}
podLabelsMap of labels to add to the pods{}

Security Context

ParameterDescriptionDefault
podSecurityContext.fsGroupGroup ID for the volumes of the pod999
containerSecurityContext.allowPrivilegeEscalationEnable container privilege escalationfalse
containerSecurityContext.runAsNonRootConfigure the container to run as a non-root usertrue
containerSecurityContext.runAsUserUser ID for the PostgreSQL container999
containerSecurityContext.runAsGroupGroup ID for the PostgreSQL container999
containerSecurityContext.readOnlyRootFilesystemMount container root filesystem as read-onlyfalse
containerSecurityContext.capabilities.dropLinux capabilities to be dropped["ALL"]

PostgreSQL Authentication

ParameterDescriptionDefault
auth.usernamePostgreSQL superuser name (POSTGRES_USER). If empty, defaults to postgres.""
auth.passwordPassword for the PostgreSQL superuser (POSTGRES_PASSWORD). Auto-generated if empty.""
auth.databaseDefault database to create (POSTGRES_DB). Defaults to the superuser name if empty.""
auth.existingSecretName of an existing secret containing the superuser password. When set, the chart does not create its own secret.""
auth.secretKeys.adminPasswordKeyKey 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:

KeyDescription
postgres-passwordSuperuser password (plain-text encoded)
hostService hostname (<fullname>.<namespace>.svc)
portService port
usernameSuperuser name
databaseDefault database name
uriFull 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

ParameterDescriptionDefault
config.mountConfigMapEnable mounting of ConfigMap with PostgreSQL configurationtrue
config.extraConfigAdditional PostgreSQL configuration parameters (list of raw config lines)[]
config.existingConfigmapName of existing ConfigMap with PostgreSQL configuration""
config.pgHbaConfigContent of a custom pg_hba.conf file to be used instead of the default config""
config.postgresql.max_connectionsMaximum number of connections100
config.postgresql.shared_buffersAmount of memory the database server uses for shared memory buffers128MB
config.postgresql.effective_cache_sizeSets the planner's assumption about the total size of the data caches4GB
config.postgresql.work_memAmount of memory to be used by internal sort operations and hash tables4MB
config.postgresql.maintenance_work_memMaximum amount of memory to be used by maintenance operations64MB
config.postgresql.checkpoint_completion_targetTime spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval0.7
config.postgresql.random_page_costSets the planner's estimate of the cost of a non-sequentially-fetched disk page1.1
config.postgresql.timezoneDefault timezone settingUTC
config.postgresql.localeLocale setting for all lc_* settingsen_US.utf8
config.postgresql.default_text_search_configSets default text search configurationpg_catalog.english
config.postgresql.datestyleSets the display format for date and time valuesiso, mdy
config.postgresql.log_destinationSets the destination for server log outputstderr
config.postgresql.logging_collectorStart a subprocess to capture stderr output into log filesoff
config.postgresql.log_min_messagesSets the message levels that are loggedwarning
config.postgresql.log_min_error_statementCauses all statements generating error at or above this level to be loggederror
config.postgresql.log_statementSets the type of statements loggednone
config.postgresql.log_min_duration_statementSets the minimum execution time above which all statements will be logged-1
config.postgresql.shared_preload_librariesShared preload libraries (comma-separated list)""
config.postgresql.wal_buffersAmount of memory used in shared memory for WAL data16MB
config.postgresql.wal_levelDetermines how much information is written to the WALreplica
config.postgresql.max_wal_sendersMaximum number of concurrent connections from standby servers5
`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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartpostgres is pinned at v0.22.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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