postgresql-ha

by VNG Cloud

Helm chartv12.1.7App 16.1.0Verified publisher

This PostgreSQL cluster solution includes the PostgreSQL replication manager, an open-source tool for managing replication and failover on PostgreSQL clusters.

About this chart

PostgreSQL HA packaged by Bitnami

This PostgreSQL cluster solution includes the PostgreSQL replication manager, an open-source tool for managing replication and failover on PostgreSQL clusters.

Overview of PostgreSQL HA

Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.

TL;DR

helm install my-release oci://registry-1.docker.io/bitnamicharts/postgresql-ha

Looking to use PostgreSQL HA in production? Try VMware Tanzu Application Catalog, the enterprise edition of Bitnami Application Catalog.

Introduction

This Helm chart installs PostgreSQL with HA architecture in a Kubernetes cluster. Welcome to contribute to Helm Chart for PostgreSQL HA.

This Helm chart has been developed based on bitnami/postgresql chart but including some changes to guarantee high availability such as:

  • A new deployment, service have been added to deploy Pgpool-II to act as proxy for PostgreSQL backend. It helps to reduce connection overhead, acts as a load balancer for PostgreSQL, and ensures database node failover.
  • Replacing bitnami/postgresql with bitnami/postgresql-repmgr which includes and configures repmgr. Repmgr ensures standby nodes assume the primary role when the primary node is unhealthy.

Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters.

Prerequisites

  • Kubernetes 1.23+
  • Helm 3.8.0+

Installing the Chart

To install the chart with the release name my-release:

helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/postgresql-ha

Note: You need to substitute the placeholders REGISTRY_NAME and REPOSITORY_NAME with a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to use REGISTRY_NAME=registry-1.docker.io and REPOSITORY_NAME=bitnamicharts.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm delete --purge my-release

Additionally, if persistence.resourcePolicy is set to keep, you should manually delete the PVCs.

Parameters

Global parameters

NameDescriptionValue
global.imageRegistryGlobal Docker image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]
global.storageClassGlobal StorageClass for Persistent Volume(s)""
global.postgresql.usernamePostgreSQL username (overrides postgresql.username)""
global.postgresql.passwordPostgreSQL password (overrides postgresql.password)""
global.postgresql.databasePostgreSQL database (overrides postgresql.database)""
global.postgresql.repmgrUsernamePostgreSQL repmgr username (overrides postgresql.repmgrUsername)""
global.postgresql.repmgrPasswordPostgreSQL repmgr password (overrides postgresql.repmgrpassword)""
global.postgresql.repmgrDatabasePostgreSQL repmgr database (overrides postgresql.repmgrDatabase)""
global.postgresql.existingSecretName of existing secret to use for PostgreSQL passwords (overrides postgresql.existingSecret)""
global.ldap.bindpwLDAP bind password (overrides ldap.bindpw)""
global.ldap.existingSecretName of existing secret to use for LDAP passwords (overrides ldap.existingSecret)""
global.pgpool.adminUsernamePgpool Admin username (overrides pgpool.adminUsername)""
global.pgpool.adminPasswordPgpool Admin password (overrides pgpool.adminPassword)""
global.pgpool.existingSecretPgpool existing secret""

Common parameters

NameDescriptionValue
kubeVersionOverride Kubernetes version""
nameOverrideString to partially override common.names.fullname template (will maintain the release name)""
fullnameOverrideString to fully override common.names.fullname template""
namespaceOverrideString to fully override common.names.namespace""
commonLabelsCommon labels to add to all resources (sub-charts are not considered). Evaluated as a template{}
commonAnnotationsCommon annotations to add to all resources (sub-charts are not considered). Evaluated as a template{}
clusterDomainKubernetes Cluster Domaincluster.local
extraDeployArray of extra objects to deploy with the release (evaluated as a template)[]
diagnosticMode.enabledEnable diagnostic mode (all probes will be disabled and the command will be overridden)false
diagnosticMode.commandCommand to override all containers in the deployment[]
diagnosticMode.argsArgs to override all containers in the deployment[]

PostgreSQL with Repmgr parameters

NameDescriptionValue
postgresql.image.registryPostgreSQL with Repmgr image registryREGISTRY_NAME
postgresql.image.repositoryPostgreSQL with Repmgr image repositoryREPOSITORY_NAME/postgresql-repmgr
postgresql.image.digestPostgreSQL image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag""
postgresql.image.pullPolicyPostgreSQL with Repmgr image pull policyIfNotPresent
postgresql.image.pullSecretsSpecify docker-registry secret names as an array[]
postgresql.image.debugSpecify if debug logs should be enabledfalse
postgresql.labelsLabels to add to the StatefulSet. Evaluated as template{}
postgresql.podLabelsLabels to add to the StatefulSet pods. Evaluated as template{}
postgresql.serviceAnnotationsProvide any additional annotations for PostgreSQL service{}
postgresql.replicaCountNumber of replicas to deploy. Use an odd number. Having 3 replicas is the minimum to get quorum when promoting a new primary.3
postgresql.updateStrategy.typePostgresql statefulset strategy typeRollingUpdate
postgresql.containerPorts.postgresqlPostgreSQL port5432
postgresql.hostAliasesDeployment pod host aliases[]
postgresql.hostNetworkSpecify if host network should be enabled for PostgreSQL podfalse
postgresql.hostIPCSpecify if host IPC should be enabled for PostgreSQL podfalse
postgresql.podAnnotationsAdditional pod annotations{}
postgresql.podAffinityPresetPostgreSQL pod affinity preset. Ignored if postgresql.affinity is set. Allowed values: soft or hard""
postgresql.podAntiAffinityPresetPostgreSQL pod anti-affinity preset. Ignored if postgresql.affinity is set. Allowed values: soft or hardsoft
postgresql.nodeAffinityPreset.typePostgreSQL node affinity preset type. Ignored if postgresql.affinity is set. Allowed values: soft or hard""
postgresql.nodeAffinityPreset.keyPostgreSQL node label key to match Ignored if postgresql.affinity is set.""

Deploy postgresql-ha with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has postgresql-ha 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 chartpostgresql-ha is pinned at v12.1.7 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