postgresql
by KubeSphere
Chart for PostgreSQL with HA architecture.
About this chart
What is RadonDB PostgreSQL
RadonDB PostgreSQL is an open-source, cloud-native, highly availability cluster solutions based on PostgreSQL.
RadonDB PostgreSQL supports Kubernetes or KubeShpere platforms.
Architecture
- Supporting automatic failover through repmgr
- Load-balancing I/O traffic through Pgpool-II
- Keeping data consistency through
PostgreSQL Streaming Replication
Features
- High Availability PostgreSQL database
- Leader-follower switching in second-level
- Asynchronous or Synchronous streaming replication
- Automatic failover
- Cluster Management
- Failover and Load-Balancing
- Parameter Tuning
Installing the Chart
To install the chart with the release name my-release:
## For Helm v2
$ helm install . --name my-release
## For Helm v3
$ helm install --name my-release .
The command deploys postgresql cluster on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.
Uninstall
To uninstall/delete the my-release deployment:
$ helm delete my-release
To delete the pvc:
kubectl delete pvc data-my-release-radondb-postgresql-0
kubectl delete pvc data-my-release-radondb-postgresql-1
kubectl delete pvc data-my-release-radondb-postgresql-2
The commands remove all the Kubernetes components associated with the chart and deletes the release completely.
Configuration
| Parameter | Description | Default |
|---|---|---|
| Global | ||
global.imageRegistry | Global Docker image registry | nil |
global.imagePullSecrets | Global Docker registry secret names as an array | [] (does not add image pull secrets to deployed pods) |
global.storageClass | Global storage class for dynamic provisioning | nil |
global.postgresql.existingSecret | Name of existing secret to use for PostgreSQL passwords (overrides postgresql.existingSecret) | nil |
global.postgresql.username | PostgreSQL username (overrides postgresql.username) | nil |
global.postgresql.password | PostgreSQL password (overrides postgresql.password) | nil |
global.postgresql.database | PostgreSQL database (overrides postgresql.database) | nil |
global.postgresql.repmgrUsername | PostgreSQL repmgr username (overrides postgresql.repmgrUsername) | nil |
global.postgresql.repmgrPassword | PostgreSQL repmgr password (overrides postgresql.repmgrpassword) | nil |
global.postgresql.repmgrDatabase | PostgreSQL repmgr database (overrides postgresql.repmgrDatabase) | nil |
global.ldap.existingSecret | Name of existing secret to use for LDAP passwords (overrides ldap.existingSecret) | nil |
global.ldap.bindpw | LDAP bind password (overrides ldap.bindpw) | nil |
global.pgpool.adminUsername | Pgpool Admin username (overrides pgpool.adminUsername) | nil |
global.pgpool.adminPassword | Pgpool Admin password (overrides pgpool.adminPassword) | nil |
| General | ||
commonLabels | Labels to add to all deployed objects | nil |
commonAnnotations | Annotations to add to all deployed objects | [] |
nameOverride | String to partially override postgres-ha.fullname template with a string | nil |
fullnameOverride | String to fully override postgres-ha.fullname template with a string | nil |
clusterDomain | Default Kubernetes cluster domain | cluster.local |
extraDeploy | Array of extra objects to deploy with the release (evaluated as a template). | nil |
serviceAccount.enabled | Enable service account (Note: Service Account will only be automatically created if serviceAccount.name is not set) | false |
serviceAccount.name | Name of existing service account | nil |
| PostgreSQL with Repmgr | ||
postgresqlImage.registry | Registry for PostgreSQL with Repmgr image | docker.io |
postgresqlImage.tag | Tag for PostgreSQL with Repmgr image | {TAG_NAME} |
postgresqlImage.pullPolicy | PostgreSQL with Repmgr image pull policy | IfNotPresent |
postgresqlImage.pullSecrets | Specify docker-registry secret names as an array | [] (does not add image pull secrets to deployed pods) |
postgresqlImage.debug | Specify if debug logs should be enabled | false |
postgresql.hostAliases | Add deployment host aliases | [] |
postgresql.labels | Map of labels to add to the statefulset. Evaluated as a template | {} |
postgresql.podLabels | Map of labels to add to the pods. Evaluated as a template | {} |
postgresql.replicaCount | The number of replicas to deploy | 2 |
postgresql.updateStrategyType | Statefulset update strategy policy | RollingUpdate |
postgresql.podAnnotations | Additional pod annotations | {} |
postgresql.priorityClassName | Pod priority class | `` |
postgresql.podAffinityPreset | PostgreSQL pod affinity preset. Ignored if postgresql.affinity is set. Allowed values: soft or hard | "" |
postgresql.podAntiAffinityPreset | PostgreSQL pod anti-affinity preset. Ignored if postgresql.affinity is set. Allowed values: soft or hard | soft |
postgresql.nodeAffinityPreset.type | PostgreSQL node affinity preset type. Ignored if postgresql.affinity is set. Allowed values: soft or hard | "" |
postgresql.nodeAffinityPreset.key | PostgreSQL node label key to match Ignored if postgresql.affinity is set. | "" |
postgresql.nodeAffinityPreset.values | PostgreSQL node label values to match. Ignored if postgresql.affinity is set. | [] |
postgresql.affinity | Affinity for PostgreSQL pods assignment | {} (evaluated as a template) |
postgresql.nodeSelector | Node labels for PostgreSQL pods assignment | {} (evaluated as a template) |
postgresql.tolerations | Tolerations for PostgreSQL pods assignment | [] (evaluated as a template) |
postgresql.securityContext.* | Other pod security context to be included as-is in the pod spec | {} |
postgresql.securityContext.enabled | Enable security context for PostgreSQL with Repmgr | true |
postgresql.securityContext.fsGroup | Group ID for the PostgreSQL with Repmgr filesystem | 1001 |
postgresql.containerSecurityContext.* | Other container security context to be included as-is in the container spec | {} |
postgresql.containerSecurityContext.enabled | Enable container security context | true |
postgresql.containerSecurityContext.runAsUser | User ID for the PostgreSQL with Repmgr container | 1001 |
postgresql.resources | The [resources] to allocate for container | {} |
postgresql.livenessProbe | Liveness probe configuration for PostgreSQL with Repmgr | Check values.yaml file |
postgresql.readinessProbe | Readiness probe configuration for PostgreSQL with Repmgr | Check values.yaml file |
postgresql.startupProbe | Startup probe configuration for PostgreSQL with Repmgr | Check values.yaml file |
postgresql.customLivenessProbe | Override default liveness probe | nil |
postgresql.customReadinessProbe | Override default readiness probe | nil |
postgresql.customStartupProbe | Override default startup probe | nil |
postgresql.extraVolumeMounts | Array of extra volume mounts to be added to the container (evaluated as template). Normally used with extraVolumes. | nil |
postgresql.sidecars | Attach additional containers to the pod (evaluated as a template) | nil |
postgresql.initContainers | Add additional init containers to the pod (evaluated as a template) | nil |
postgresql.extraEnvVars | Array containing extra env vars | nil |
postgresql.extraEnvVarsCM | ConfigMap containing extra env vars | nil |
postgresql.extraEnvVarsSecret | Secret containing extra env vars (in case of sensitive data) | nil |
postgresql.command | Override default container command (useful when using custom images) | nil |
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartpostgresql is pinned at v1.0.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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