Cette page présente l'opérateur Kubernetes AlloyDB Omni et explique comment l'utiliser pour déployer AlloyDB Omni sur un cluster Kubernetes. Cette page part du principe que vous connaissez les opérations Kubernetes de base.
Pour obtenir des instructions sur l'installation d'AlloyDB Omni dans un environnement Linux standard, consultez Installer AlloyDB Omni.
Présentation
Pour déployer AlloyDB Omni sur un cluster Kubernetes, installez l'opérateur AlloyDB Omni, une extension de l'API Kubernetes fournie par Google.
Vous configurez et contrôlez un cluster de base de données AlloyDB Omni basé sur Kubernetes en associant des fichiers manifestes déclaratifs à l'utilitaire kubectl, comme pour tout autre déploiement basé sur Kubernetes. Vous n'utilisez pas la CLI AlloyDB Omni, qui est destinée aux déploiements sur des machines Linux individuelles et non sur des clusters Kubernetes.
Avant de commencer
Vous devez avoir accès aux éléments suivants :
Un cluster Kubernetes exécutant les logiciels suivants :
Si vous devez installer gcloud CLI, notez que l'étape d'exécution de gcloud init est facultative. L'installation d'AlloyDB Omni ne nécessite pas d'authentification avec un compte Google.
Chaque nœud du cluster Kubernetes doit disposer des éléments suivants :
Au moins deux processeurs x86 ou AMD64.
Au moins 8 Go de RAM.
Version 4.18 ou ultérieure du noyau Linux.
Le groupe de contrôle v2 (cgroup v2) est activé.
Utiliser des charts Helm
Vous pouvez utiliser les charts Helm du dépôt alloydb-omni-samples pour déployer les composants présentés dans ce guide.
Installer l'opérateur AlloyDB Omni
Pour installer l'opérateur AlloyDB Omni, procédez comme suit :
Si l'installation aboutit, la sortie suivante devrait s'afficher :
NAME: alloydbomni-operator
LAST DEPLOYED: CURRENT_TIMESTAMP
NAMESPACE: alloydb-omni-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
Effectuez le nettoyage en supprimant le fichier d'installation de l'opérateur AlloyDB Omni téléchargé. Le fichier est nommé alloydbomni-operator-VERSION_NUMBER.tgz et se trouve dans votre répertoire de travail actuel.
Créer un cluster de bases de données
Un cluster de bases de données AlloyDB Omni contient toutes les ressources de stockage et de calcul nécessaires à l'exécution d'un serveur AlloyDB Omni, y compris le serveur principal, les réplicas et toutes vos données.
Après avoir installé l'opérateur AlloyDB Omni sur votre cluster Kubernetes, vous pouvez créer un cluster de bases de données AlloyDB Omni sur le cluster Kubernetes en appliquant un fichier manifeste semblable à celui-ci :
DB_CLUSTER_NAME : nom de ce cluster de bases de données, par exemple my-db-cluster.
ENCODED_PASSWORD : mot de passe de connexion à la base de données pour le rôle utilisateur postgres par défaut, encodé sous forme de chaîne base64 (par exemple, Q2hhbmdlTWUxMjM= pour ChangeMe123).
CPU_COUNT : nombre de processeurs disponibles pour chaque instance de base de données de ce cluster de bases de données.
MEMORY_SIZE : quantité de mémoire par instance de base de données de ce cluster de bases de données. Nous vous recommandons de définir cette valeur sur 8 gigaoctets par processeur. Par exemple, si vous avez défini cpu sur 2 plus haut dans ce fichier manifeste, nous vous recommandons de définir memory sur 16Gi.
DISK_SIZE : taille du disque par instance de base de données, par exemple 10Gi.
Une fois ce fichier manifeste appliqué, votre cluster Kubernetes contient un cluster de bases de données AlloyDB Omni avec la configuration de mémoire, de processeur et de stockage spécifiée. Pour établir une connexion de test avec le nouveau cluster de bases de données, consultez Se connecter à l'aide de psql préinstallé.
Pour en savoir plus sur les fichiers manifestes Kubernetes et sur la façon de les appliquer, consultez Gérer les ressources.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis guide explains how to deploy AlloyDB Omni onto a Kubernetes cluster using the AlloyDB Omni Operator, an extension to the Kubernetes API.\u003c/p\u003e\n"],["\u003cp\u003eDeployment of AlloyDB Omni on Kubernetes clusters is managed through declarative manifest files and the \u003ccode\u003ekubectl\u003c/code\u003e utility, not the AlloyDB Omni CLI.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting, you need access to a Kubernetes cluster, \u003ccode\u003ecert-manager\u003c/code\u003e, \u003ccode\u003ekubectl\u003c/code\u003e, \u003ccode\u003ehelm\u003c/code\u003e, and the Google Cloud CLI, and ensure each node has sufficient CPU, RAM, and Linux kernel version.\u003c/p\u003e\n"],["\u003cp\u003eThe installation of the AlloyDB Omni Operator involves defining environment variables, downloading the operator, and installing it via Helm, with a cleanup step afterward.\u003c/p\u003e\n"],["\u003cp\u003eCreating an AlloyDB Omni database cluster in Kubernetes involves applying a manifest file that defines the cluster's name, version, CPU, memory, and disk specifications.\u003c/p\u003e\n"]]],[],null,["# Install AlloyDB Omni on Kubernetes\n\nSelect a documentation version: 15.5.2keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/deploy-kubernetes)\n- [16.8.0](/alloydb/omni/16.8.0/docs/deploy-kubernetes)\n- [16.3.0](/alloydb/omni/16.3.0/docs/deploy-kubernetes)\n- [15.12.0](/alloydb/omni/15.12.0/docs/deploy-kubernetes)\n- [15.7.1](/alloydb/omni/15.7.1/docs/deploy-kubernetes)\n- [15.7.0](/alloydb/omni/15.7.0/docs/deploy-kubernetes)\n- [15.5.5](/alloydb/omni/15.5.5/docs/deploy-kubernetes)\n- [15.5.4](/alloydb/omni/15.5.4/docs/deploy-kubernetes)\n- [15.5.2](/alloydb/omni/15.5.2/docs/deploy-kubernetes)\n\n\u003cbr /\u003e\n\n| **Note:** Your use of AlloyDB Omni is subject to the agreement between you and Google that governs Google Cloud offerings. If you do not have a Google Cloud account, or have not otherwise entered into an agreement with Google that governs Google Cloud offerings, please do not proceed or download this software until you have done so. To create a Google Cloud account, see [the Google Cloud homepage](/docs/get-started).\n\n\u003cbr /\u003e\n\nThis page provides an overview of the AlloyDB Omni Kubernetes Operator, with instructions\nfor using it to deploy AlloyDB Omni onto a Kubernetes cluster. This\npage assumes basic familiarity with Kubernetes operation.\n\nFor instructions on installing AlloyDB Omni onto a standard Linux\nenvironment, see [Install AlloyDB Omni](/alloydb/omni/15.5.2/docs/install).\n\nOverview\n--------\n\nTo deploy AlloyDB Omni onto a Kubernetes cluster, install the\nAlloyDB Omni Operator, an extension to the Kubernetes API provided by\nGoogle.\n\nYou configure and control a Kubernetes-based AlloyDB Omni database\ncluster by pairing declarative manifest files with the `kubectl` utility, just\nlike any other Kubernetes-based deployment. You do not use [the\nAlloyDB Omni CLI](/alloydb/omni/15.5.2/docs/omni-cli), which is intended for\ndeployments onto individual Linux machines and not Kubernetes clusters.\n\nBefore you begin\n----------------\n\nYou need access to the following:\n\n- A Kubernetes cluster, running the following software:\n - Kubernetes version 1.21 or later.\n - [The `cert-manager` service](https://cert-manager.io/docs/installation).\n- [The `kubectl` utility](https://kubernetes.io/docs/tasks/tools/#kubectl).\n- [The `helm` package manager](https://helm.sh/docs/intro/install/).\n- The [Google Cloud CLI](/sdk/docs/install).\n\n If you do need to install the gcloud CLI, note that the step of\n running `gcloud init` is optional. Installing AlloyDB Omni\n does not require authentication with a Google Account.\n\nEach node in the Kubernetes cluster must have the following:\n\n- A minimum of two x86 or AMD64 CPUs.\n- At least 8GB of RAM.\n- Linux kernel version 4.18 or later.\n- Control group v2 (cgroup v2) enabled.\n\nUse Helm charts\n---------------\n\nYou can use Helm charts from the repository [alloydb-omni-samples](https://github.com/GoogleCloudPlatform/alloydb-omni-samples/tree/main/k8s/helm) to deploy the components shown in this guide.\n\nInstall the AlloyDB Omni Operator\n---------------------------------\n\nTo install the AlloyDB Omni Operator, follow these steps:\n\n1. Define several environment variables:\n\n export GCS_BUCKET=alloydb-omni-operator\n export HELM_PATH=$(gcloud storage cat gs://$GCS_BUCKET/latest)\n export OPERATOR_VERSION=\"${HELM_PATH%%/*}\"\n\n2. Download the AlloyDB Omni Operator:\n\n gcloud storage cp gs://$GCS_BUCKET/$HELM_PATH ./ --recursive\n\n3. Install the AlloyDB Omni Operator:\n\n helm install alloydbomni-operator alloydbomni-operator-${OPERATOR_VERSION}.tgz \\\n --create-namespace \\\n --namespace alloydb-omni-system \\\n --atomic \\\n --timeout 5m\n\n Successful installation displays the following output: \n\n NAME: alloydbomni-operator\n LAST DEPLOYED: \u003cvar translate=\"no\"\u003eCURRENT_TIMESTAMP\u003c/var\u003e\n NAMESPACE: alloydb-omni-system\n STATUS: deployed\n REVISION: 1\n TEST SUITE: None\n\n4. Clean up by deleting the downloaded AlloyDB Omni Operator\n installation file. The file is named\n `alloydbomni-operator-`\u003cvar translate=\"no\"\u003eVERSION_NUMBER\u003c/var\u003e`.tgz`, and is located in\n your current working directory.\n\nCreate a database cluster\n-------------------------\n\nAn AlloyDB Omni *database cluster* contains all the storage and\ncompute resources needed to run an AlloyDB Omni server, including\nthe primary server, any replicas, and all of your data.\n\nAfter you install the AlloyDB Omni Operator on your Kubernetes cluster,\nyou can create an AlloyDB Omni database cluster on the Kubernetes\ncluster by applying a manifest similar to the following: \n\n apiVersion: v1\n kind: Secret\n metadata:\n name: db-pw-\u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e\n type: Opaque\n data:\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nt\"\u003eDB_CLUSTER_NAME\u003c/span\u003e\u003c/var\u003e: \"\u003cvar translate=\"no\"\u003eENCODED_PASSWORD\u003c/var\u003e\"\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 spec:\n databaseVersion: \"15.5.2\"\n primarySpec:\n adminUser:\n passwordRef:\n name: db-pw-\u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e\n resources:\n cpu: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eCPU_COUNT\u003c/span\u003e\u003c/var\u003e\n memory: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eMEMORY_SIZE\u003c/span\u003e\u003c/var\u003e\n disks:\n - name: DataDisk\n size: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eDISK_SIZE\u003c/span\u003e\u003c/var\u003e\n storageClass: standard\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDB_CLUSTER_NAME\u003c/var\u003e: the name of this database cluster---for\n example, `my-db-cluster`.\n\n- \u003cvar translate=\"no\"\u003eENCODED_PASSWORD\u003c/var\u003e: the database login password for the\n default `postgres` user role, encoded as a base64 string---for example,\n `Q2hhbmdlTWUxMjM=` for `ChangeMe123`.\n\n- \u003cvar translate=\"no\"\u003eCPU_COUNT\u003c/var\u003e: the number of CPUs available to each\n database instance in this database cluster.\n\n- \u003cvar translate=\"no\"\u003eMEMORY_SIZE\u003c/var\u003e: the amount of memory per database instance of this\n database cluster. We recommend setting this to 8 gigabytes per CPU. For\n example, if you set `cpu` to `2` earlier in this manifest, then we recommend\n setting `memory` to `16Gi`.\n\n- \u003cvar translate=\"no\"\u003eDISK_SIZE\u003c/var\u003e: the disk size per database instance---for example, `10Gi`.\n\nAfter you apply this manifest, your Kubernetes cluster contains an\nAlloyDB Omni database cluster with the specified memory, CPU,\nand storage configuration. To establish a test connection with the new\ndatabase cluster, see [Connect using the preinstalled `psql`](/alloydb/omni/15.5.2/docs/run-connect#psql-kubernetes).\n\nFor more information about Kubernetes manifests and how to apply them, see\n[Managing\nresources](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/).\n\nWhat's next\n-----------\n\n- [Run and connect to AlloyDB Omni](/alloydb/omni/15.5.2/docs/run-connect)\n- [Manage AlloyDB Omni](/alloydb/omni/15.5.2/docs/manage)\n- [Manage high availability in Kubernetes](/alloydb/omni/15.5.2/docs/kubernetes-ha)"]]