如果您运行的是 AlloyDB Omni 操作器 1.0.0 版或更高版本,则后续步骤取决于您要升级到的 AlloyDB Omni 版本。AlloyDB Omni 版本号包含以下组成部分:
PostgreSQL 兼容性的主要版本号
PostgreSQL 兼容性的次要版本号
此 AlloyDB Omni 发布版本的补丁版本号
例如,AlloyDB Omni 16.8.0 版支持 PostgreSQL 15.7 版,并且没有 AlloyDB Omni 发布版本补丁。
选择适合您的目标版本的安装选项:
安装场景
更新步骤
您希望升级到支持较新版本 PostgreSQL 的 AlloyDB Omni 版本。
升级 AlloyDB Omni 操作器和数据库集群。每组支持特定 PostgreSQL 次要版本的 AlloyDB Omni 发布版本都有自己的 AlloyDB Omni 操作器版本号。使用 AlloyDB Omni 操作器版本兼容性表验证您的 AlloyDB Omni 操作器版本是否与您的操作器版本兼容。
如果您使用 alloydb_omni_instance_postgresql_wait_time_second_total 指标,则必须将其更新为 alloydb_omni_instance_postgresql_wait_time_us_total。如需同时使用这两个指标,请使用 Prometheus OR 运算符。
(promQL A) OR (promQL A, but replace all occurrences of alloydb_omni_instance_postgresql_wait_time_second_total to alloydb_omni_instance_postgresql_wait_time_us_total)
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-22。"],[],[],null,["# Upgrade your AlloyDB Omni Kubernetes operator to version 1.5.0\n\nSelect a documentation version: 16.8.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/upgrade-kubernetes-operator-version)\n- [16.8.0](/alloydb/omni/16.8.0/docs/upgrade-kubernetes-operator-version)\n- [16.3.0](/alloydb/omni/16.3.0/docs/upgrade-kubernetes-operator-version)\n- [15.12.0](/alloydb/omni/15.12.0/docs/upgrade-kubernetes-operator-version)\n- [15.7.1](/alloydb/omni/15.7.1/docs/upgrade-kubernetes-operator-version)\n\n\u003cbr /\u003e\n\nThis page describes how to upgrade the AlloyDB Omni operator to version 1.5.0. The steps to upgrade depend on your current version of AlloyDB Omni and the version that you upgrade to.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nWhen you upgrade the AlloyDB Omni operator, the database\nrestarts unless all of the following are true:\n\n- You're upgrading the AlloyDB Omni operator version 1.1.1 to a newer version.\n- You're using the AlloyDB Omni database version 15.5.5 or later.\n- AlloyDB AI is not enabled. For more information, see [Create a database cluster with AlloyDB AI](/alloydb/omni/16.8.0/docs/install-with-alloydb-ai?resource=kubernetes#enable-alloydb-ai).\n\nIf the database restarts, no data loss is expected.\n\nStarting from the AlloyDB Omni database version 15.7.1, high\navailability (HA) on your Kubernetes-based AlloyDB Omni database\nclusters uses a new architecture to provide more hardening and improvements for\nHA automatic setup, failover, and healing capabilities.\n\nIf you're upgrading the AlloyDB Omni database version from\n15.7.0 (or earlier) to version 15.7.1 (or later), or if you're downgrading\nversions, you must disable HA, and you must re-enable HA after the process\ncompletes.\n\nDetermine your current versions\n-------------------------------\n\nTo check the version of AlloyDB Omni used by your database\ncluster, run the following command: \n\n kubectl get dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -o jsonpath='{.status.primary.currentDatabaseVersion}'\n\nMake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e: the name of your database cluster. It's\n the same database cluster name that you declared when you created it. For\n more information, see\n [Install AlloyDB Omni on Kubernetes](/alloydb/omni/16.8.0/docs/deploy-kubernetes#create).\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the Kubernetes namespace of your database\n cluster.\n\nIf you run version 1.0.0 or later of the AlloyDB Omni operator, then this\ncommand prints the version of AlloyDB Omni used by your database\ncluster.\n\nTo check the version of the AlloyDB Omni operator installed on your\nKubernetes cluster, run the following command: \n\n kubectl get dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -o jsonpath='{.status.primary.currentControlPlaneAgentsVersion}'\n\nIf you run version 1.0.0 or later of the AlloyDB Omni operator, the\noutput is the version number of the AlloyDB Omni operator running on your\nKubernetes cluster.\n\nIf you run a version of AlloyDB Omni operator earlier than\n1.0.0, follow the instructions in\n[Upgrade from a pre-1.0.0 AlloyDB Omni operator](/alloydb/omni/16.8.0/docs/manage#older-operator).\nOtherwise,\n[check your target version numbers](#check-target-version).\n\nCheck your target version numbers\n---------------------------------\n\nIf you run a version of AlloyDB Omni operator 1.0.0 or later, then\nyour next steps depend on the version of AlloyDB Omni that\nyou want to upgrade to. The AlloyDB Omni version number has\nthe following components:\n\n- The major version number of its PostgreSQL compatibility\n- The minor version number of its PostgreSQL compatibility\n- The patch version number of this AlloyDB Omni release\n\nFor example, AlloyDB Omni version 16.8.0\nsupports PostgreSQL version 15.7 and doesn't have a AlloyDB Omni\nrelease patch.\n\nChoose the installation option that works for your target version:\n\nUpgrade the AlloyDB Omni operator\n---------------------------------\n\nTo upgrade the AlloyDB Omni operator, follow these steps:\n\n1. Define the environment variables:\n\n export GCS_BUCKET=alloydb-omni-operator\n export OPERATOR_VERSION=\u003cvar translate=\"no\"\u003eOPERATOR_VERSION\u003c/var\u003e\n export HELM_PATH=$OPERATOR_VERSION/alloydbomni-operator-$OPERATOR_VERSION.tgz\n\n Replace \u003cvar translate=\"no\"\u003eOPERATOR_VERSION\u003c/var\u003e with the version of the\n AlloyDB Omni operator that you're upgrading to---for example,\n `1.5.0`.\n2. Download the latest AlloyDB Omni operator:\n\n gcloud storage cp -r gs://$GCS_BUCKET/$HELM_PATH ./\n tar -xvzf alloydbomni-operator-${OPERATOR_VERSION}.tgz\n\n3. Apply the latest AlloyDB Omni operator custom resource definitions:\n\n kubectl apply -f alloydbomni-operator/crds\n\n4. Upgrade the AlloyDB Omni operator Helm chart:\n\n helm upgrade alloydbomni-operator alloydbomni-operator-${OPERATOR_VERSION}.tgz \\\n --namespace alloydb-omni-system \\\n --atomic \\\n --timeout 5m\n\nUpdate OpenShift database clusters from version 1.4.1 or earlier\n----------------------------------------------------------------\n\nStarting with version 1.5.0, the AlloyDB Omni operator is compatible\nwith OpenShift's default `restricted-v2` security context constraint. For new\ndatabase clusters on OpenShift running `controlPlaneAgentsVersion` 1.5.0 or\nlater, OpenShift [injects arbitrary user IDs](https://www.redhat.com/en/blog/a-guide-to-openshift-and-uids)\nfor the database workloads. For database clusters running an older version, the\ndatabase workloads must continue to run as default user ID `999`.\n\nTo update a database cluster on OpenShift from a `controlPlaneAgentsVersion`\nearlier than 1.5.0, follow these steps:\n\n1. Grant the database cluster's service account permission to use the `anyuid`\n security context constraint. This enables the database workload to run as\n default user ID.\n\n oc adm policy add-scc-to-user anyuid system:serviceaccount:\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e:\u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e-sa\n\n2. Annotate the database cluster with `openshift.io/scc=anyuid`.\n The AlloyDB Omni operator version 1.5.0 or later recognizes\n this annotation and runs the database workloads as default user ID\n on OpenShift instead of allowing the platform to inject an arbitrary ID.\n\n kubectl annotate dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e openshift.io/scc=anyuid\n\n3. Proceed with the steps to [update the database cluster](#upgrade-clusters) to the latest version.\n\nUpdate the database clusters\n----------------------------\n\nTo update the `dbCluster`, complete the following steps:\n\n1. If you're upgrading an HA AlloyDB Omni database cluster from\n database version 15.7.0 (or earlier) to version 15.7.1 (or later), follow\n these steps to disable HA.\n\n | **Note:** If you're upgrading from an older version to version 15.7.0 (or earlier), or from version 15.7.1 (or later) to a newer version, skip this step.\n 1. Set the `numberOfStandbys` to `0` in the cluster's manifest.\n\n spec:\n availability:\n numberOfStandbys: 0\n\n 1. To disable HA, re-apply the manifest.\n2. Update the `databaseVersion` and the `controlPlaneAgentsVersion` versions in\n the cluster's manifest, and re-apply the manifest.\n\n Run the following example, which is part of a manifest file that specifies version\n 16.8.0 of `databaseVersion` and version\n 1.5.0 of `controlPlaneAgentsVersion`: \n\n apiVersion: alloydbomni.dbadmin.goog/v1\n kind: DBCluster\n metadata:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eDB_CLUSTER_NAME\u003c/span\u003e\u003c/var\u003e\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE\u003c/span\u003e\u003c/var\u003e\n spec:\n databaseVersion: \"16.8.0\"\n controlPlaneAgentsVersion: \"1.5.0\"\n ...\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e: the name of your database cluster. It's the same database cluster name that you declared when you created it. For more information, see [Install AlloyDB Omni on Kubernetes](/alloydb/omni/16.8.0/docs/deploy-kubernetes#create).\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the Kubernetes namespace of your database cluster.\n3. Wait for the upgrade to complete successfully.\n\n4. If you disabled HA before the upgrade, complete the following steps.\n\n 1. Set the `numberOfStandbys` back to the number prior to upgrade in the\n cluster's manifest.\n\n 2. Re-apply the manifest to re-enable HA.\n\nUpdate `alloydb_omni_instance_postgresql_wait_time_second_total`\n----------------------------------------------------------------\n\nIf you're using the `alloydb_omni_instance_postgresql_wait_time_second_total`\nmetric, you must update it to\n`alloydb_omni_instance_postgresql_wait_time_us_total`. To consume both metrics,\nuse the Prometheus `OR` operator. \n\n (promQL A) OR (promQL A, but replace all occurrences of alloydb_omni_instance_postgresql_wait_time_second_total to alloydb_omni_instance_postgresql_wait_time_us_total)\n\nIf you use `seconds` as the unit for this metric, you must convert it\nto `us`.\n\nFor more information, see the [release notes](/alloydb/omni/16.8.0/docs/release-notes)."]]