Create an empty database cluster for the new AlloyDB Omni
version.
kexec-tiPOD_NAME--/bin/Bash
postgres@POD_NAME:~$supervisorctl.parstoppostgres
# Initialize a new, empty database cluster for the new version.
postgres@POD_NAME:~$rm-fr/mnt/disks/pgsql/data;initdb-D/mnt/disks/pgsql/data-Ualloydbadmin--data-checksums--encoding=UTF8--locale=C--locale-provider=icu--icu-locale=und-x-icu--auth-host=trust--auth-local=reject;cd~
Replace the following variable:
POD_NAME: the name of your pod.
Modify pg_hba.conf in your pre-existing database cluster to provide the
upgrade process the permissions and connections it needs.
# Backup pg_hba.conf of the pg15 cluster
postgres@POD_NAME:~$cp/mnt/disks/pgsql/15/data/pg_hba.conf/mnt/disks/pgsql/15/data/pg_hba.conf.bak
# Update pg15 configurations
postgres@POD_NAME:~$echo"local all all trust" >> /mnt/disks/pgsql/15/data/pg_hba.conf;echo"host all all 127.0.0.1/32 trust" >> /mnt/disks/pgsql/15/data/pg_hba.conf
Replace the following variable:
POD_NAME: the name of your pod.
Modify pg_hba.conf in the new database cluster to provide the upgrade
process the permissions and connections it needs.
postgres@POD_NAME:~$rm/mnt/disks/pgsql/data/pg_hba.conf;echo"local all all trust" >> /mnt/disks/pgsql/data/pg_hba.conf;echo"host all all 127.0.0.1/32 trust" >> /mnt/disks/pgsql/data/pg_hba.conf;chmod2740/mnt/disks/pgsql/15/data
Replace the following variable:
POD_NAME: the name of your pod.
Upgrade your database cluster.
# (optional) Make sure postgres is stopped
postgres@POD_NAME:~$supervisorctl.parstoppostgres
# (optional) Check to verify that data can be upgraded.
postgres@POD_NAME:~$pg_upgrade-Ualloydbadmin--check-b/mnt/disks/pgsql/15/bin-B/usr/lib/postgresql/16/bin-d/mnt/disks/pgsql/15/data-D/mnt/disks/pgsql/data--link-v
postgres@POD_NAME:~$pg_upgrade-Ualloydbadmin-b/mnt/disks/pgsql/15/bin-B/usr/lib/postgresql/16/bin-d/mnt/disks/pgsql/15/data-D/mnt/disks/pgsql/data--link-v
# Need to recover pg15 configurations
postgres@POD_NAME:~$cp/mnt/disks/pgsql/15/data/pg_hba.conf.bak/mnt/disks/pgsql/data/pg_hba.conf;cp-r/mnt/disks/pgsql/15/data/postgresql.conf/mnt/disks/pgsql/data/.;cp-r/mnt/disks/pgsql/15/data/postgresql.conf.d/mnt/disks/pgsql/data/.;cp-r/mnt/disks/pgsql/15/data/parambackup/mnt/disks/pgsql/data/.
# Start postgres
postgres@POD_NAME:~$supervisorctl.parstartpostgres
# Clean up backup data
postgres@POD_NAME:~$rm-fr/mnt/disks/pgsql/15/
Replace the following variable:
POD_NAME: the name of your pod.
Remove the manual version upgrade annotation from your database cluster.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Upgrade to AlloyDB Omni version 16.8.0 on Kubernetes\n\nSelect a documentation version: 16.8.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/upgrade-kubernetes-alloydb-omni-version)\n- [16.8.0](/alloydb/omni/16.8.0/docs/upgrade-kubernetes-alloydb-omni-version)\n- [16.3.0](/alloydb/omni/16.3.0/docs/upgrade-kubernetes-alloydb-omni-version)\n\n\u003cbr /\u003e\n\nThis page describes how to upgrade to AlloyDB Omni version 16.8.0 on Kubernetes.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\n- Ensure that your AlloyDB Omni Kubernetes operator version is\n `1.5.0`. To upgrade your\n AlloyDB Omni operator version, see\n [Migrate to the latest AlloyDB Omni Kubernetes operator version](/alloydb/omni/16.8.0/docs/upgrade-kubernetes-operator-version).\n\n- Ensure that you have at least 5GB of free disk space.\n\n- If you run external or remote backup systems, perform a full backup and\n pause any scheduled backups to avoid backing up during the upgrade process.\n\n- For\n [high availability (HA) and data resilience (DR)](/alloydb/omni/16.8.0/docs/high-availability/overview)\n environments, decouple your database clusters before upgrading them.\n\nUpgrade your AlloyDB Omni version\n---------------------------------\n\nTo upgrade your AlloyDB Omni version using `pg_upgrade`, do one\nof the following:\n\n- Run the [Bash script](#upgrade-script) that performs the upgrade for you.\n\n- [Run the upgrade instructions manually](#manual-upgrade).\n\nUpgrade script\n--------------\n\nYou can find a script that performs the [manual upgrade steps](#manual-upgrade)\nin the\n[AlloyDB Omni samples on GitHub](https://github.com/GoogleCloudPlatform/alloydb-omni-samples/tree/main/samples/MVU.sh).\n\nTo use the upgrade script, download the script and run the following command: \n\n ./MVU.sh 16.8.0 1.5.0 \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\nReplace the following variables:\n\n- \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the namespace for your database cluster.\n\nManual upgrade steps\n--------------------\n\n1. [Back up your data](/alloydb/omni/16.8.0/docs/backup-kubernetes) to avoid any data loss.\n\n2. [Remove your backup plan](/alloydb/omni/16.8.0/docs/backup-kubernetes).\n\n3. Terminate all replication processes. This includes\n [physical replication](/alloydb/omni/16.8.0/docs/about-pglogical) used for\n [high availability (HA) and data resilience (DR)](/alloydb/omni/16.8.0/docs/high-availability/overview)\n as well as all [logical replication](/alloydb/omni/16.8.0/docs/create-replication-slots)\n streams.\n\n4. Annotate your database cluster to specify a manual version upgrade.\n\n kubectl annotate dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e dbs.dbadmin.goog.com/manualmvu=true\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n5. Stop the PostgreSQL process so that data can be moved for the upgrade.\n\n k exec -ti \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e -- /bin/Bash\n # Shut down postgres\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ mkdir /mnt/disks/pgsql/15; mv /mnt/disks/pgsql/data /mnt/disks/pgsql/15/data; cp -r /usr/lib/postgresql/15/bin /mnt/disks/pgsql/15/.; cp -r /usr/lib/postgresql/15/lib /mnt/disks/pgsql/15/.; cp -r /usr/share/postgresql/15 /mnt/disks/pgsql/15/share; rm /mnt/disks/pgsql/15/share/postgresql.conf.sample; cp /usr/share/postgresql/postgresql.conf.sample /mnt/disks/pgsql/15/share/postgresql.conf.sample; chmod 2740 /mnt/disks/pgsql/15/data\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n6. Patch your database cluster to version `16.8.0` and\n your control plane agents (CPA) to `1.5.0`.\n\n kubectl patch dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e --type=merge -p '{\"spec\":{\"databaseVersion\":\"16.8.0\",\"controlPlaneAgentsVersion\":\"omni_control_plane_agents_version\"}}'\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n7. Create an empty database cluster for the new AlloyDB Omni\n version.\n\n k exec -ti \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e -- /bin/Bash\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n # Initialize a new, empty database cluster for the new version.\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm -fr /mnt/disks/pgsql/data; initdb -D /mnt/disks/pgsql/data -U alloydbadmin --data-checksums --encoding=UTF8 --locale=C --locale-provider=icu --icu-locale=und-x-icu --auth-host=trust --auth-local=reject; cd ~\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n8. Modify `pg_hba.conf` in your pre-existing database cluster to provide the\n upgrade process the permissions and connections it needs.\n\n # Backup pg_hba.conf of the pg15 cluster\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ cp /mnt/disks/pgsql/15/data/pg_hba.conf /mnt/disks/pgsql/15/data/pg_hba.conf.bak\n\n # Update pg15 configurations\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ echo \"local all all trust\" \u003e\u003e /mnt/disks/pgsql/15/data/pg_hba.conf; echo \"host all all 127.0.0.1/32 trust\" \u003e\u003e /mnt/disks/pgsql/15/data/pg_hba.conf\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n9. Modify `pg_hba.conf` in the new database cluster to provide the upgrade\n process the permissions and connections it needs.\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm /mnt/disks/pgsql/data/pg_hba.conf; echo \"local all all trust\" \u003e\u003e /mnt/disks/pgsql/data/pg_hba.conf; echo \"host all all 127.0.0.1/32 trust\" \u003e\u003e /mnt/disks/pgsql/data/pg_hba.conf; chmod 2740 /mnt/disks/pgsql/15/data\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n10. Upgrade your database cluster.\n\n # (optional) Make sure postgres is stopped\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n # (optional) Check to verify that data can be upgraded.\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ pg_upgrade -U alloydbadmin --check -b /mnt/disks/pgsql/15/bin -B /usr/lib/postgresql/16/bin -d /mnt/disks/pgsql/15/data -D /mnt/disks/pgsql/data --link -v\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ pg_upgrade -U alloydbadmin -b /mnt/disks/pgsql/15/bin -B /usr/lib/postgresql/16/bin -d /mnt/disks/pgsql/15/data -D /mnt/disks/pgsql/data --link -v\n\n # Need to recover pg15 configurations\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ cp /mnt/disks/pgsql/15/data/pg_hba.conf.bak /mnt/disks/pgsql/data/pg_hba.conf; cp -r /mnt/disks/pgsql/15/data/postgresql.conf /mnt/disks/pgsql/data/.; cp -r /mnt/disks/pgsql/15/data/postgresql.conf.d /mnt/disks/pgsql/data/.; cp -r /mnt/disks/pgsql/15/data/parambackup /mnt/disks/pgsql/data/.\n\n # Start postgres\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par start postgres\n\n # Clean up backup data\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm -fr /mnt/disks/pgsql/15/\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n11. Remove the manual version upgrade annotation from your database cluster.\n\n kubectl annotate dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e dbs.dbadmin.goog.com/manualmvu-\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n12. Resume normal operations and re-enable any backups, backup plans, or\n replication processes disabled in steps one to three."]]