2023-11-07 15:13:26 +00:00
|
|
|
# Upgrade Postgres major version
|
|
|
|
|
|
|
|
## backup
|
|
|
|
|
|
|
|
- shell into running posgres-auth pod
|
|
|
|
```
|
|
|
|
export PGPASSWORD="<postgres_password from secret>"
|
|
|
|
cd /bitnami/posgres
|
|
|
|
pg_dumpall > backup
|
|
|
|
```
|
|
|
|
|
|
|
|
- store backup off-site
|
|
|
|
```
|
|
|
|
kubectl cp keycloak/kubezero-auth-postgresql-0:/bitnami/postgresql/backup postgres-backup
|
|
|
|
```
|
|
|
|
|
|
|
|
## upgrade
|
|
|
|
|
|
|
|
- upgrade auth chart
|
2023-11-08 16:12:53 +00:00
|
|
|
- set replica of the keycloak statefulSet to 0
|
|
|
|
- set replica of the postgres-auth statefulSet to 0
|
2023-11-07 15:13:26 +00:00
|
|
|
- delete postgres-auth PVC and POD to flush old DB
|
|
|
|
|
|
|
|
## restore
|
|
|
|
|
2023-11-08 16:12:53 +00:00
|
|
|
- restore replica of postgres-auth statefulSet
|
2023-11-07 15:13:26 +00:00
|
|
|
- copy backup to new PVC
|
|
|
|
```
|
|
|
|
kubectl cp postgres-backup keycloak/kubezero-auth-postgresql-0:/bitnami/postgresql/backup
|
|
|
|
```
|
|
|
|
|
|
|
|
- log into psql as admin ( shell on running pod )
|
|
|
|
```
|
|
|
|
psql -U postgres
|
|
|
|
```
|
|
|
|
|
2023-11-08 16:12:53 +00:00
|
|
|
- drop database `keycloak` in case the keycloak instances connected early
|
2023-11-07 15:13:26 +00:00
|
|
|
```
|
|
|
|
DROP database keycloak
|
|
|
|
```
|
|
|
|
|
|
|
|
- actual restore
|
|
|
|
```
|
|
|
|
psql -U postgres -d postgres -f backup
|
|
|
|
```
|
|
|
|
|
2023-11-08 16:12:53 +00:00
|
|
|
- reset replia of keycloak statefulSet or force ArgoCD sync
|
2023-11-07 15:13:26 +00:00
|
|
|
|
|
|
|
success.
|