postgresql

by [riftbit]

Helm chartv10.11.0App 11.13.0Verified publisher

Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.

About this chart

PostgreSQL

PostgreSQL is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.

For HA, please see this repo

TL;DR

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

Introduction

This chart bootstraps a PostgreSQL deployment on a Kubernetes cluster using the Helm package manager.

Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the BKPR.

Prerequisites

  • Kubernetes 1.12+
  • Helm 3.1.0
  • PV provisioner support in the underlying infrastructure

Installing the Chart

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

$ helm install my-release bitnami/postgresql

The command deploys PostgreSQL on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release.

To delete the PVC's associated with my-release:

$ kubectl delete pvc -l release=my-release

Note: Deleting the PVC's will delete postgresql data as well. Please be cautious before doing it.

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.postgresqlDatabasePostgreSQL database (overrides postgresqlDatabase)""
global.postgresql.postgresqlUsernamePostgreSQL username (overrides postgresqlUsername)""
global.postgresql.existingSecretName of existing secret to use for PostgreSQL passwords (overrides existingSecret)""
global.postgresql.postgresqlPasswordPostgreSQL admin password (overrides postgresqlPassword)""
global.postgresql.servicePortPostgreSQL port (overrides service.port""
global.postgresql.replicationPasswordReplication user password (overrides replication.password)""

Common parameters

NameDescriptionValue
nameOverrideString to partially override common.names.fullname template (will maintain the release name)""
fullnameOverrideString to fully override common.names.fullname template""
extraDeployArray of extra objects to deploy with the release (evaluated as a template)[]
commonAnnotationsAdd annotations to all the deployed resources{}
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["sleep"]
diagnosticMode.argsArgs to override all containers in the deployment["infinity"]

PostgreSQL parameters

NameDescriptionValue
image.registryPostgreSQL image registrydocker.io
image.repositoryPostgreSQL image repositorybitnami/postgresql
image.tagPostgreSQL image tag (immutable tags are recommended)11.13.0-debian-10-r40
image.pullPolicyPostgreSQL image pull policyIfNotPresent
image.pullSecretsSpecify image pull secrets[]
image.debugSpecify if debug values should be setfalse
volumePermissions.enabledEnable init container that changes volume permissions in the data directory (for cases where the default k8s runAsUser and fsUser values do not work)false
volumePermissions.image.registryInit container volume-permissions image registrydocker.io
volumePermissions.image.repositoryInit container volume-permissions image repositorybitnami/bitnami-shell
volumePermissions.image.tagInit container volume-permissions image tag (immutable tags are recommended)10-debian-10-r200
volumePermissions.image.pullPolicyInit container volume-permissions image pull policyAlways
volumePermissions.image.pullSecretsInit container volume-permissions image pull secrets[]
volumePermissions.securityContext.runAsUserUser ID for the init container0
schedulerNameUse an alternate scheduler, e.g. "stork".""
lifecycleHooksfor the PostgreSQL container to automate configuration before or after startup{}
securityContext.enabledEnable security contexttrue
securityContext.fsGroupGroup ID for the pod1001
containerSecurityContext.enabledEnable container security contexttrue
containerSecurityContext.runAsUserUser ID for the container1001
serviceAccount.enabledEnable service account (Note: Service Account will only be automatically created if serviceAccount.name is not set)false
serviceAccount.nameName of an already existing service account. Setting this value disables the automatic service account creation""
serviceAccount.autoMountAuto-mount the service account token in the podfalse
psp.createCreate Pod Security Policyfalse
rbac.createCreate Role and RoleBinding (required for PSP to work)false
replication.enabledEnable replicationfalse
replication.userReplication userrepl_user
replication.passwordReplication user passwordrepl_password
replication.readReplicasNumber of read replicas replicas1
replication.synchronousCommitSet synchronous commit mode. Allowed values: on, remote_apply, remote_write, local and offoff
replication.numSynchronousReplicasNumber of replicas that will have synchronous replication. Note: Cannot be greater than replication.readReplicas.0
replication.applicationNameCluster application name. Useful for advanced replication settingsmy_application
replication.singleServiceCreate one service connecting to all read-replicastrue
replication.uniqueServicesCreate a unique service for each independent read-replicafalse
postgresqlPostgresPasswordPostgreSQL admin password (used when postgresqlUsername is not postgres, in which casepostgres is the admin username)""
postgresqlUsernamePostgreSQL user (has superuser privileges if username is postgres)postgres
postgresqlPasswordPostgreSQL user password""
existingSecretName of existing secret to use for PostgreSQL passwords""
usePasswordFileMount PostgreSQL secret as a

Deploy postgresql with OpenTenant

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