4.1. Official Charts

In this lab, you install PostgreSQL from the chart of Bitnami into a namespace of its own, customize it with values and roll a change back.

Step 1: Inspect the Chart

Bitnami publishes its charts in an OCI registry, the same kind of registry that stores container images. You find charts like this one on Artifact Hub. Create a directory for the files of this lab and change into it:

mkdir -p ~/labs/4.1
cd ~/labs/4.1

Show the description of the chart:

helm show chart oci://registry-1.docker.io/bitnamicharts/postgresql --version 18.12.4
Pulled: registry-1.docker.io/bitnamicharts/postgresql:18.12.4
...
appVersion: 18.6.0
...
description: PostgreSQL (Postgres) is an open source object-relational database known
  for reliability and data integrity. ACID-compliant, it supports foreign keys, joins,
  views, triggers and stored procedures.
...
name: postgresql
...
version: 18.12.4

Save the settings of the chart with their default values to a file:

helm show values oci://registry-1.docker.io/bitnamicharts/postgresql --version 18.12.4 > values-default.yaml

Open values-default.yaml in your editor and search for @param auth.postgresPassword and @param metrics.enabled. You set these settings in Step 2 and Step 3:

auth:
  ...
  ## @param auth.postgresPassword Password for the "postgres" admin user. Ignored if `auth.existingSecret` is provided
  ##
  postgresPassword: ""
  ## @param auth.username Name for a custom user to create
  ##
  username: ""
  ## @param auth.password Password for the custom user to create. Ignored if `auth.existingSecret` is provided
  ##
  password: ""
  ## @param auth.database Name for a custom database to create
  ##
  database: ""
metrics:
  ## @param metrics.enabled Start a prometheus exporter
  ##
  enabled: false

Explanation

version is the version of the chart, appVersion the version of PostgreSQL it installs. --version pins the chart version, so you get the same chart every time. Without it, Helm takes the newest one.

The values are the settings of the chart: the file has about 2000 lines, each with its default and a comment. The oci:// address tells Helm to load the chart from an OCI registry, so you don’t need to add a repository first.


Step 2: Install PostgreSQL

Create the file values.yaml in ~/labs/4.1. It sets the password of the admin user postgres and creates a user and a database for the message board, which you connect to this database in 4.2:

auth:
  postgresPassword: s3cr3t-admin
  username: messages
  password: s3cr3t
  database: messages

Install the chart as the release postgresql into the new namespace postgresql-dev:

helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 18.12.4 \
  -n postgresql-dev --create-namespace -f values.yaml
Pulled: registry-1.docker.io/bitnamicharts/postgresql:18.12.4
...
NAME: postgresql
LAST DEPLOYED: Tue Oct 13 16:43:46 2026
NAMESPACE: postgresql-dev
STATUS: deployed
REVISION: 1
...
NOTES:
...
PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

    postgresql.postgresql-dev.svc.cluster.local - Read/Write connection
...
WARNING: Rolling tag detected (bitnami/postgresql:latest), please note that it is strongly recommended to avoid using rolling tags in a production environment.
...

List the releases of the namespace:

helm list -n postgresql-dev
NAME         NAMESPACE        REVISION   UPDATED                                   STATUS     CHART                APP VERSION
postgresql   postgresql-dev   1          2026-10-13 16:20:55.498558317 +0000 UTC   deployed   postgresql-18.12.4   18.6.0

Wait about 20 seconds and list the Pods and Services of the namespace:

kubectl get pods -n postgresql-dev
NAME           READY   STATUS    RESTARTS   AGE
postgresql-0   1/1     Running   0          17s

If postgresql-0 isn’t 1/1 yet, wait a moment and repeat the command.

kubectl get services -n postgresql-dev
NAME            TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
postgresql      ClusterIP   10.43.2.72   <none>        5432/TCP   17s
postgresql-hl   ClusterIP   None         <none>        5432/TCP   17s

Explanation

With one command, Helm created everything PostgreSQL needs: a StatefulSet, two Services and a Secret with the passwords. The StatefulSet then started the Pod postgresql-0 and created its PVC. The release lives in a namespace of its own, named after the application and its environment. --create-namespace creates it, -n tells helm and kubectl where to work, and -f passes your values file. The resources are named after the release, e.g. the StatefulSet postgresql.

Clients connect to postgresql. postgresql-hl has no cluster IP (None): the StatefulSet uses it to give each Pod a DNS name of its own, e.g. postgresql-0.postgresql-hl.

The passwords, the user and the database belong in the first installation: PostgreSQL creates them when it starts for the first time, so changing them later in the values doesn’t change the database. Without a password, the chart generates a random one. Keep real passwords out of files you commit: the chart can read them from an existing Secret instead (auth.existingSecret).

Below NOTES, the chart prints how to use it, e.g. the DNS name of the database and how to read the password from its Secret. The first warnings say that the images use the tag latest, which can point to a new version at any time (see the notice below). The last warning says that the chart sets CPU and memory of the containers from a preset, which is fine for the lab.

Bitnami images

Since August 2025, Bitnami offers only a small set of hardened images for free: with the tag latest only, meant for development and testing. Versioned images moved to the archive bitnamilegacy and no longer get updates; fixed versions with updates need a paid subscription (Bitnami Secure Images). The chart works for this lab. For production, use images with a fixed, maintained version. If the installation can’t download an image, Bitnami has changed its catalog again: ask the trainer.


Step 3: Customize with Values

Turn on the metrics exporter, which you found in Step 1. Add it to values.yaml, below auth:

auth:
  postgresPassword: s3cr3t-admin
  username: messages
  password: s3cr3t
  database: messages
metrics:
  enabled: true

Upgrade the release with your values:

helm upgrade postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 18.12.4 \
  -n postgresql-dev -f values.yaml
Pulled: registry-1.docker.io/bitnamicharts/postgresql:18.12.4
...
Release "postgresql" has been upgraded. Happy Helming!
NAME: postgresql
...
STATUS: deployed
REVISION: 2
...

Wait about 20 seconds and list the Pods and Services:

kubectl get pods -n postgresql-dev
NAME           READY   STATUS    RESTARTS   AGE
postgresql-0   2/2     Running   0          13s

If the Pod isn’t 2/2 yet, wait a moment and repeat the command.

kubectl get services -n postgresql-dev
NAME                 TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
postgresql           ClusterIP   10.43.2.72    <none>        5432/TCP   33s
postgresql-hl        ClusterIP   None          <none>        5432/TCP   33s
postgresql-metrics   ClusterIP   10.43.69.27   <none>        9187/TCP   15s

Explanation

values.yaml contains only what you want to change. Every other setting keeps its default. helm upgrade applied it as revision 2: to add the exporter as a second container, the StatefulSet replaced the Pod. Its AGE starts again, and the data stays on the PVC. The exporter publishes the statistics of PostgreSQL on port 9187 and got a Service of its own.

Changing values instead of manifests keeps the chart untouched, so you can upgrade it to a newer version later and keep your settings.


Step 4: Roll Back

Show the history of the release:

helm history postgresql -n postgresql-dev
REVISION   UPDATED                    STATUS       CHART                APP VERSION   DESCRIPTION
1          Tue Oct 13 16:20:55 2026   superseded   postgresql-18.12.4   18.6.0        Install complete
2          Tue Oct 13 16:21:13 2026   deployed     postgresql-18.12.4   18.6.0        Upgrade complete

Roll back to revision 1:

helm rollback postgresql 1 -n postgresql-dev
Rollback was a success! Happy Helming!

Wait about 15 seconds, list the Pods and show the history again:

kubectl get pods -n postgresql-dev
NAME           READY   STATUS    RESTARTS   AGE
postgresql-0   1/1     Running   0          13s

If postgresql-0 isn’t 1/1 yet, wait a moment and repeat the command.

helm history postgresql -n postgresql-dev
REVISION   UPDATED                    STATUS       CHART                APP VERSION   DESCRIPTION
1          Tue Oct 13 16:20:55 2026   superseded   postgresql-18.12.4   18.6.0        Install complete
2          Tue Oct 13 16:21:13 2026   superseded   postgresql-18.12.4   18.6.0        Upgrade complete
3          Tue Oct 13 16:21:28 2026   deployed     postgresql-18.12.4   18.6.0        Rollback to 1

Explanation

The rollback didn’t delete revision 2. It created revision 3 with the values of revision 1: the users and the database stay, the exporter is gone. The history stays complete, so you can return to any revision.

As with kubectl rollout undo in 2.4, your file still says enabled: true: the next helm upgrade with values.yaml turns the exporter on again.

Keep the release running. In 4.2, the message board stores its messages in this database.


Optional Tasks

Finished early? Try these tasks. The following labs don’t depend on them. Each task lists the commands you need. Open the solution if you get stuck.

Task 1: Behind the Scenes

Find out which values the release uses (now and in revision 2) and which resources Helm created for it.

CommandEffect
helm get values <release> -n <namespace> --revision <number>Shows the values you set, for a revision of the release
helm get manifest <release> -n <namespace>Shows the manifests that Helm created for the release
Solution

Show the values of the current revision and of revision 2:

helm get values postgresql -n postgresql-dev
USER-SUPPLIED VALUES:
auth:
  database: messages
  password: s3cr3t
  postgresPassword: s3cr3t-admin
  username: messages
helm get values postgresql -n postgresql-dev --revision 2
USER-SUPPLIED VALUES:
auth:
  database: messages
  password: s3cr3t
  postgresPassword: s3cr3t-admin
  username: messages
metrics:
  enabled: true

List the kinds of the created resources:

helm get manifest postgresql -n postgresql-dev | grep "^kind:"
kind: NetworkPolicy
kind: PodDisruptionBudget
kind: ServiceAccount
kind: Secret
kind: Service
kind: Service
kind: StatefulSet

The chart created more than you saw with kubectl get, e.g. a NetworkPolicy, which controls which connections may reach the database Pod, and a PodDisruptionBudget, which limits how many of its Pods may be stopped at once during maintenance of a node. The PVC isn’t listed: the StatefulSet created it, not Helm.

Task 2: Say Hello

Connect to PostgreSQL as the admin user postgres with psql and ask for its version. Then check that the Secret postgresql contains your admin password under the key postgres-password.

CommandEffect
kubectl exec <pod> -n <namespace> -- psql -U <user> -c "<sql>"Runs an SQL statement with the PostgreSQL client in the Pod
env <NAME>=<value> <command>Runs a command with an additional environment variable
kubectl get secret <name> -n <namespace> -o jsonpath="{.data.<key>}"Shows a single value of the Secret, base64-encoded
Solution

Run psql in the Pod. It reads the password from the environment variable PGPASSWORD:

kubectl exec postgresql-0 -n postgresql-dev -- env PGPASSWORD=s3cr3t-admin psql -U postgres -c "select version()"
                                   version
------------------------------------------------------------------------------
 PostgreSQL 18.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 12.5.0, 64-bit
(1 row)

Read the password from the Secret. The NOTES of the chart use base64 -d; --decode works on macOS and Linux alike:

kubectl get secret postgresql -n postgresql-dev -o jsonpath="{.data.postgres-password}" | base64 --decode
s3cr3t-admin

The chart stored the passwords from your values in the Secret (the one of the user messages under the key password), and the StatefulSet passes them to PostgreSQL.

Task 3: Seeing Double

Install the same chart with the same release name a second time, into a new namespace postgresql-test. List all releases of the cluster and uninstall the second one again. Check what’s left in the namespace postgresql-test, then delete it.

CommandEffect
helm list -ALists the releases of all namespaces
helm uninstall <release> -n <namespace>Removes a release
Solution

Install the second release:

helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 18.12.4 \
  -n postgresql-test --create-namespace -f ~/labs/4.1/values.yaml

List all releases:

helm list -A
NAME         NAMESPACE         REVISION   UPDATED                                   STATUS     CHART                APP VERSION
postgresql   postgresql-dev    3          2026-10-13 16:21:28.678288671 +0000 UTC   deployed   postgresql-18.12.4   18.6.0
postgresql   postgresql-test   1          2026-10-13 16:21:45.861050512 +0000 UTC   deployed   postgresql-18.12.4   18.6.0

A release name only has to be unique within its namespace, so each environment can use the same one. Remove the second release:

helm uninstall postgresql -n postgresql-test

List the PVCs of the namespace:

kubectl get pvc -n postgresql-test
NAME                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
data-postgresql-0   Bound    pvc-dd8cc551-e8a9-46d0-bf6d-3e9b5974a61b   8Gi        RWO            local-path     <unset>                 6s

The PVC is still there: Helm only deletes what it created, and the StatefulSet created the PVC. That protects the data of a database from an accidental uninstall. Delete the namespace together with everything left in it. This takes about ten seconds, up to 50 seconds if PostgreSQL was still starting:

kubectl delete namespace postgresql-test