postgresql-ha

by joaquinito2051

Helm chartv9.4.9App 14.5.0

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.

Azure-ready Charts with Containers from marketplace.azurecr.io

This Helm Chart has been configured to pull the Container Images from the Azure Marketplace Public Repository. The following command allows you to download and install all the charts from this repository.

$ helm repo add bitnami-azure https://marketplace.azurecr.io/helm/v1/repo

TL;DR

$ helm repo add my-repo https://charts.bitnami.com/bitnami
$ helm install my-release my-repo/postgresql-ha

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.19+
  • Helm 3.2.0+

Installing the Chart

Install the PostgreSQL HA helm chart with a release name my-release:

$ helm repo add my-repo https://charts.bitnami.com/bitnami
$ helm install my-release my-repo/postgresql-ha

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 registrydocker.io
postgresql.image.repositoryPostgreSQL with Repmgr image repositorybitnami/postgresql-repmgr
postgresql.image.tagPostgreSQL with Repmgr image tag14.5.0-debian-11-r28
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.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.""
postgresql.nodeAffinityPreset.valuesPostgreSQL node label values 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 v9.4.9 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