Skip to main content
helm chart · postgres

PostgreSQL

Helm chart for deploying postgres datastore

Latest version
v0.0.15
Chart type
Data source
Requires
Helm 3+

Install

Add the zop.dev chart repository, then install postgres into your cluster.

helm repo add zopdev https://helm.zop.dev
helm repo update
helm install my-postgres zopdev/postgres --version v0.0.15

The PostgreSQL Helm chart provides a straightforward way to deploy and manage PostgreSQL instances in your Kubernetes cluster. It offers customizable options for persistence, resource configuration, and scalability to cater to a wide range of workloads.


Prerequisites

  • Kubernetes 1.19+
  • Helm 3+

Add Helm Repository

Before installing the PostgreSQL chart, add the repository to your Helm installation and update the repository index:

Terminal window
helm repo add zopdev https://helm.zop.dev
helm repo update

See Helm Repository Documentation for additional information.


Install Helm Chart

To install the PostgreSQL Helm chart, execute the following command:

Terminal window
helm install [RELEASE_NAME] zopdev/postgres

Replace [RELEASE_NAME] with the desired release name.

For example:

Terminal window
helm install my-postgres zopdev/postgres

To customize the deployment, use a custom values.yaml file or override values directly via the command line.

See Helm Install Documentation for further details.


Uninstall Helm Chart

To uninstall the PostgreSQL Helm chart and remove all associated Kubernetes resources, use:

Terminal window
helm uninstall [RELEASE_NAME]

For example:

Terminal window
helm uninstall my-postgres

See Helm Uninstall Documentation for additional details.


Configuration

The PostgreSQL Helm chart provides a variety of configurable parameters. The table below outlines the key configurations:

InputTypeDescriptionDefault
postgresRootPasswordstringRoot password for the PostgreSQL instance. Leave unset for default random generation.None
imagestringDocker image and tag for the PostgreSQL container.postgres:15.9
resources.requests.cpustringMinimum CPU resources required by the PostgreSQL container."500m"
resources.requests.memorystringMinimum memory resources required by the PostgreSQL container."256M"
resources.limits.cpustringMaximum CPU resources the PostgreSQL container can use."1500m"
resources.limits.memorystringMaximum memory resources the PostgreSQL container can use."1Gi"
diskSizestringSize of the persistent volume claim (PVC) for storing PostgreSQL data."10Gi"
updateStrategy.typestringUpdate strategy for the deployment. Options: RollingUpdate or Recreate.RollingUpdate

You can override these values in a values.yaml file or pass them as flags during installation.


Example values.yaml File

Terminal window
version: "17.4.0"
replication:
enabled: false
count: 1
diskSize : "10Gi"
resources:
requests:
cpu: "250m"
memory: "500Mi"
limits:
cpu: "500m"
memory: "1000Mi"

To use this configuration, save it in a values.yaml file and apply it during installation:

Terminal window
helm install my-postgres zopdev/postgres -f values.yaml

Features

  • Persistence: Store PostgreSQL data across pod restarts using persistent volume claims.
  • Resource Optimization: Define resource requests and limits to suit your workload and cluster capacity.
  • Rolling Updates: Ensure zero downtime during updates with the default RollingUpdate strategy.
  • Customizable Configurations: Flexibly tailor the deployment using Helm values.

Advanced Usage

Custom Secrets for Root Password

You can provide a pre-existing Kubernetes secret to manage the PostgreSQL root password securely. Update the values.yaml file to include the secret name:

Terminal window
postgresRootPassword:
secretName: my-postgres-secret

Create the secret before deploying the chart:

Terminal window
kubectl create secret generic my-postgres-secret --from-literal=postgres-root-password=my-secure-password

Pod Scheduling

nodeSelector, tolerations and affinity are passed straight through to the pod spec. All three are empty by default and render nothing, so leaving them unset changes nothing for an existing release.

They apply to the primary StatefulSet and, when replication.enabled, the replicas.

They also apply to the per-service db-init Jobs. A Job that could not tolerate the pool while the StatefulSet could would leave the databases uncreated, with the release still reporting deployed.

Together they place the workload on a dedicated node pool — the nodeSelector picks the pool, the toleration gets past its taint:

Terminal window
nodeSelector:
workload: stateful
tolerations:
- key: workload
operator: Equal
value: stateful
effect: NoSchedule

affinity takes a full Affinity object and is rendered verbatim.


Contributing

We welcome contributions to improve this Helm chart. Please refer to the CONTRIBUTING.md file for contribution guidelines.


Code of Conduct

To maintain a healthy and collaborative community, please adhere to our Code of Conduct.


License

This project is licensed under the LICENSE. Please review it for terms of use.


Connection Config

  • DB_DIALECT : Specifies the database dialect . In this context ,it is always “postgres”.
  • DB_USER : Username used to connect to PostgreSQL database.
  • DB_PORT : The port number used to connect to the PostgreSQL server.Usually 5432.
  • DB_HOST : The hostname or service name of the postgres server.
  • DB_NAME : The name of the specific database to connect to.
  • DB_PASSWORD : Are dynamically generated per service, stored in Kubernetes secrets.
  • DATABASE_URL : The full connection URL .

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

472 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

472 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·