postgresql

by Helm

Helm chartv0.2.5App 11.5.0Apache-2.0

PostgreSQL is an open-source object-relational database management system (ORDBMS) emphasizing extensibility and technical standards compliance.

About this chart

Helm Chart for PostgreSQL

$${\color{red}This \space project \space is \space not \space maintained \space anymore.}$$

If you are interested in maintaining a fork of this project, you can advertise it in the dedicated issue.

Introduction

This Helm chart installs postgreSQL in a Kubernetes cluster.

Prerequisites

  • Kubernetes cluster 1.10+
  • Helm 3.0.0+
  • PV provisioner support in the underlying infrastructure.

Installation

Add Helm repository

helm repo add cetic https://cetic.github.io/helm-charts
helm repo update

Configure the chart

The following items can be set via --set flag during installation or configured by editing the values.yaml directly (need to download the chart first).

Configure the way how to expose postgreSQL service:

  • ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster.
  • NodePort: Exposes the service on each Node’s IP at a static port (the NodePort). You’ll be able to contact the NodePort service, from outside the cluster, by requesting NodeIP:NodePort.
  • LoadBalancer: Exposes the service externally using a cloud provider’s load balancer.

Configure the way how to persistent data:

  • Disable: The data does not survive the termination of a pod.
  • Persistent Volume Claim(default): A default StorageClass is needed in the Kubernetes cluster to dynamic provision the volumes. Specify another StorageClass in the storageClass or set existingClaim if you have already existing persistent volumes to use.

How to use LDAP:

LDAP is used only to validate the user name/password pairs. Therefore the user must already exist in the database before LDAP can be used for authentication. If you enable ldap a CronJob will be activated, it will run the tool pg-ldap-sync that will copy users from your ldap server to your database.

Install the chart

Install the postgresql helm chart with a release name my-release:

helm install my-release cetic/postgresql

Uninstallation

To uninstall/delete the my-release deployment:

helm delete --purge my-release

Configuration

The following table lists the configurable parameters of the postgresql chart and the default values.

ParameterDescriptionDefault
Image
image.repositorypostgresql Image namepostgres
image.tagpostgresql Image tag11.5
image.pullPolicypostgresql Image pull policyIfNotPresent
image.pullSecretpostgresql Image pull secretnil
postgresql properties
postgresql.usernamepostgresql usernamepostgres
postgresql.passwordpostgresql passwordpostgres
postgresql.databasepostgresql databasepostgres
postgresql.portpostgresql port5432
postgresql.dataDirPostgreSQL data dir folder/var/lib/postgresql/data/pgdata
postgresql.configRuntime Config Parametersnil
postgresql.pghbaContent of pg_hba.confnil (do not create pg_hba.conf)
postgresql.initdbscriptsContent of initdbscripts.sh ( commands to be executed at the start of postgres )nil (do not create initdbscripts.sh)
postgresql.configMapConfigMap with the PostgreSQL configuration files (Note: Overrides postgresqlConfiguration and pgHbaConfiguration). The value is evaluated as a template.nil
extraEnvAny extra environment variables you would like to pass on to the pod. The value is evaluated as a template.{}
Service
service.typeType of service for postgresql frontendCusterIP
service.loadBalancerIPLoadBalancerIP if service type is LoadBalancernil
service.clusterIPClusterIP if service type is ClusterIPnil
service.loadBalancerSourceRangesAddress that are allowed when svc is LoadBalancer[]
service.annotationsService annotations{}
Volume Permissions
volumePermissions.image.registryInit container volume-permissions image registrydocker.io
volumePermissions.image.repositoryInit container volume-permissions image namedebian
volumePermissions.image.tagInit container volume-permissions image tagbuster-slim
volumePermissions.image.pullPolicyInit container volume-permissions image pull policyAlways
volumePermissions.securityContext.runAsUserUser ID for the init container0
Security Context
securityContext.enabledEnable security contexttrue
securityContext.fsGroupGroup ID for the container1001
securityContext.runAsUserUser ID for the container1001
LDAP
ldap.enabledUse ldap authenticationfalse
ldap.pgldapconfigpgldap config file``
ldap.cron.scheduleCron job schedule""
ldap.cron.repoCron job Docker imageceticasbl/pg-ldap-sync
ldap.cron.tagCron job Docker image taglatest
ldap.cron.restartPolicyRestart policy of the cron jobNever
ldap.cron.mountPathPath to mount the volume at``
ldap.cron.subPathSubdirectory of the volume to mount at``
Persistence
persistence.enabledUse persistent volume to store datafalse
persistence.mountPathPath to mount the volume at/var/lib/postgresql
persistence.subPathSubdirectory of the volume to mount at""
persistence.storageClassStorage class name of PVCsstandard
persistence.accessModeReadWriteOnce or ReadOnly[ReadWriteOnce]
persistence.sizeSize of persistent volume claim10Gi
ReadinessProbe
readinessProbeRediness Probe settingsnil
LivenessProbe
livenessProbeLiveness Probe setting

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 v0.2.5 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