ELMA365 On-Premises > Prepare infrastructure > Databases > Discontinued PostgreSQL support / Updating PostgreSQL container 10 to 15

Updating PostgreSQL container 10 to 15

When updating PostgreSQL to a major version, it is necessary to update the version of the running pod to a later version of PostgreSQL. It is also necessary to recreate the storage to update the data stored in the PostgreSQL data files.

 

Updating a PostgreSQL container consists of five steps:

  1. Database backup.
  2. Installation of PostgreSQL 15 in a Kubernetes cluster.
  3. Recreation of storage.
  4. Starting PostgreSQL.
  5. Database recovery.

Step 1. Database backup

Before carrying out any actions related to the update, create a backup of the PostgreSQL data and configuration. Read more about how to do this in Backup and recover databases.

начало внимание

If there are third-party databases on the PostgreSQL server, backups of these databases should also be created.

конец внимание

Backup of the PostgreSQL database without using the elma365-backupper utility

Step 2. Installation of PostgreSQL 15 in a Kubernetes cluster

  1. Stop the container: postgres:

kubectl scale -n <<namespace>> statefulset -l app.kubernetes.io/instance=<<namespace>>,app.kubernetes.io/name=postgresql --replicas 0

  1. Save the statefulsets configuration of the postgres pod to the file postgresql.yaml:

kubectl get statefulsets -n <<namespace>> -lapp.kubernetes.io/instance=<<namespace>>,app.kubernetes.io/name=postgresql -o yaml > path/to/postgresql.yaml

  1. Open the postgresql.yaml  file by using the command:

sudo nano path/to/postgresql.yaml

In this file, replace the version image with version docker.io/bitnami/postgresql:15.4.0.

  1. Apply the changes for pod postgres:

kubectl apply -f path/to/postgresql.yaml

Step 3. Recreation of storage

Delete storage postgresql:

kubectl delete pvc -n <<namespace>> -l app.kubernetes.io/instance=<<namespace>>,app.kubernetes.io/name=postgresql --wait=false

Step 4. Starting PostgreSQL

Start the container postgres:

kubectl scale -n <<namespace>> statefulset -l app.kubernetes.io/instance=<<namespace>>,app.kubernetes.io/name=postgresql --replicas 1

Step 5. Database recovery

Read more about how to do this in Backup and recover databases.

Recovery of the PostgreSQL database without using the elma365-backupper utility

Found a typo? Highlight the text, press ctrl + enter and notify us