This document describes how to migrate from PostgreSQL 11 that was used for charts < 3.0.0 to PostgreSQL 12.
Note The procedure describes below causes downtime of your service.
- Create a persistent volume claim that will be used to store backup.
kubectl -n <your-namespace> create -f examples/backup-pvc.yaml
- Mount an extra volume to the postgresql deployment using the following values.
# values.yaml
# postgresql specific settings (https://hub.helm.sh/charts/bitnami/postgresql/8.6.13)
postgresql:
master:
extraVolumes:
- name: backup
persistentVolumeClaim:
claimName: backup-rasa-x-postgresql-0
extraVolumeMounts:
- mountPath: /backup
name: backup
- Upgrade the deployment.
helm -n <your-namespace> upgrade -f values.yaml --reuse-values <release-name> rasa-x/rasa-x
- Create a backup
kubectl -n tczekajlo-test exec <release-name>-postgresql-0 -- /bin/bash -c 'PGPASSWORD=${POSTGRES_PASSWORD} pg_dump -U postgres --format=c --file=/backup/dump_backup.bak rasa'
- Update the chart repository.
helm repo update
- Change PostgreSQL data directory and mount the backup volume.
# values.yaml
postgresql:
image:
# tag of PostgreSQL Image
tag: "12.8.0"
extraEnv:
- name: PGDATA
value: /bitnami/postgresql/data_12
# Mount the volume with the backup
master:
extraVolumes:
- name: backup
persistentVolumeClaim:
claimName: backup-rasa-x-postgresql-0
extraVolumeMounts:
- mountPath: /backup
name: backup
Apply the values:
helm -n <your-namespace> upgrade -f values.yaml <release-name> --version <helm-chart-version> rasa-x/rasa-x
Helm chart version can be checked by executing the helm -n <namespace> list
.
- Restore the backup
kubectl -n <your-namespace> exec rasa-x-postgresql-0 -- /bin/bash -c 'PGPASSWORD=${POSTGRES_PASSWORD} pg_restore --format=c -U postgres --dbname=rasa --exit-on-error --no-acl --no-owner --role=postgres /backup/dump_backup.bak'
The backup volume is not needed anymore and can be removed from the deployment.