Utiliser Artifact Registry comme registre privé pour les images de charges de travail
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment configurer un cluster administrateur Google Distributed Cloud (logiciel uniquement) pour VMware afin qu'il utilise Artifact Registry de Google comme registre Docker privé où vous pouvez stocker des images de charge de travail. Lorsque vous configurez un registre privé pour stocker des images de charge de travail, les images système Google Distributed Cloud sont également stockées dans le registre privé lorsque vous créez ou mettez à niveau des clusters.
Bien qu'Artifact Registry soit compatible avec plusieurs méthodes d'authentification, vous devez utiliser une clé de compte de service pour l'authentification afin d'utiliser Artifact Registry en tant que registre privé. Les étapes de cette page expliquent comment obtenir l'adresse, les identifiants et le certificat d'autorité de certification requis par la section privateRegistry du fichier de configuration du cluster d'administrateur.
Configurer un fichier d'identifiants
Si vous n'avez pas configuré l'authentification pour le registre, suivez la procédure décrite dans la section Configurer l'authentification auprès d'Artifact Registry pour Docker pour configurer l'authentification à l'aide d'un compte de service. Vous devez utiliser un compte de service avec un fichier de clé JSON pour l'authentification.
Créez un fichier de configuration des identifiants, admin-creds.yaml, comme illustré dans l'exemple suivant. La valeur username doit être "_json_key". Vous pouvez utiliser n'importe quelle valeur pour le champ name, à condition qu'elle corresponde à la valeur que vous ajouterez au champ privateRegistry.entry.
Dans le répertoire où se trouve le fichier de clé JSON du compte de service du Registre, exécutez cat sur le fichier de clé pour afficher le contenu.
Copiez l'intégralité du contenu de la clé JSON, puis collez-le dans le champ password. Veillez à entourer le contenu de la clé JSON de guillemets simples, car il contient des guillemets doubles. Exemple :
Configurer privateRegistry dans le fichier de configuration du cluster d'administrateur
Pour utiliser un registre privé, vous devez configurer la section privateRegistry lorsque vous créez le cluster d'administration. Une fois le cluster créé, vous ne pouvez pas modifier privateRegistry.address, mais les autres paramètres sont modifiables et vous pouvez les mettre à jour si nécessaire.
Exécutez la commande suivante pour obtenir l'adresse du Registre:
Utilisez la valeur registryUri dans la sortie pour privateRegistry.address.
Exécutez la commande suivante pour extraire le certificat CA du point de terminaison d'Artifact Registry et l'enregistrer dans un fichier nommé ar-ca.pem:
CREDENTIAL_FILE_PATH: chemin d'accès complet ou relatif du fichier admin-creds.yaml.
CA_CERT_PATH: chemin d'accès complet ou relatif du fichier ar-ca.pem.
COMPONENT_ACCESS_KEY_PATH: chemin d'accès complet ou relatif du fichier de clé du compte de service d'accès au composant.
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/08/31 (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/08/31 (UTC)."],[],[],null,["This page describes how to configure a Google Distributed Cloud (software only) for\nVMware admin cluster to use Google's\n[Artifact Registry](/artifact-registry/docs/overview) as the private Docker registry\nwhere you can store workload images. When you configure a private registry to\nstore workload images, the Google Distributed Cloud system images are also stored in the\nprivate registry when you create or upgrade clusters.\n\nAlthough Artifact Registry supports several different\n[authentication methods](/artifact-registry/docs/docker/authentication#methods),\nyou must use a service account key for authentication to use Artifact Registry as a\nprivate registry. The steps on this page explain how to get the address,\ncredentials, and CA certificate that the\n[`privateRegistry`](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/admin-cluster-configuration-file-latest#privateregistry-section)\nsection in the admin cluster configuration file requires.\n\nConfigure a credentials file\n\n1. If you haven't configured authentication for the registry, follow the steps\n in\n [Configure authentication to Artifact Registry for Docker](/artifact-registry/docs/docker/authentication)\n to configure authentication using a service account. You must use a\n service account with a JSON key file for authentication.\n\n2. Create a credentials configuration file, `admin-creds.yaml`, as shown in\n the following example. The `username` must be `\"_json_key\"`. You can use any\n value for the `name` field, as long it matches the value you will add to the\n `privateRegistry.entry` field.\n\n apiVersion: v1\n kind: \"CredentialFile\"\n items:\n - name: \"private-registry-creds\"\n username: \"_json_key\"\n password:\n\n3. In the directory where the JSON key file for the registry's service account\n is located, run `cat` on the key file to output the contents.\n\n4. Copy the entire JSON key contents and paste it in the `password` field. Make\n sure to surround the JSON key contents with single quotes since the contents\n contain double quotes. For example:\n\n apiVersion: v1\n kind: \"CredentialFile\"\n items:\n - name: \"private-registry-creds\"\n username: \"_json_key\"\n password: '{\n \"type\": \"service_account\",\n \"project_id\": \"example-project-12345\",\n \"private_key_id\": \"d2661ccb21e686658c6552cf1e0166b857091b2e\",\n \"private_key\": \"-----BEGIN PRIVATE ... -----END PRIVATE KEY-----\\n\",\n \"client_email\": \"test-537@example-project-12345.iam.gserviceaccount.com\",\n \"client_id\": \"111772984510027821291\",\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/test-537%40example-project-12345.iam.gserviceaccount.com\",\n \"universe_domain\": \"googleapis.com\"\n }\n '\n\nConfigure `privateRegistry` in the admin cluster configuration file\n\nTo use a private registry, you need to configure the `privateRegistry` section\nwhen you create the admin cluster. After the cluster is created, you can't\nchange the `privateRegistry.address`, but the other settings are mutable and\nyou can update them if needed.\n\n1. Run the following command to get the registry address:\n\n gcloud artifacts repositories describe \u003cvar translate=\"no\"\u003eREGISTRY_NAME\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n --location=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eREGISTRY_NAME\u003c/var\u003e: the name of the registry.\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project the registry was created in.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the region that the registry was created in, such as `us-west2`.\n\n The output is similar to the following: \n\n Encryption: Google-managed key\n Repository Size: 0.000MB\n cleanupPolicyDryRun: true\n createTime: '2025-01-28T03:27:57.701672Z'\n dockerConfig: {}\n format: DOCKER\n mode: STANDARD_REPOSITORY\n name: projects/example-project-12345/locations/us-west2/repositories/test\n registryUri: us-west2-docker.pkg.dev/example-project-12345/test\n satisfiesPzi: true\n updateTime: '2025-01-28T03:27:57.701672Z'\n vulnerabilityScanningConfig:\n enablementConfig: INHERITED\n enablementState: SCANNING_ACTIVE\n lastEnableTime: '2025-01-28T03:27:49.385246079Z'\n\n Use the `registryUri` value in the output for the `privateRegistry.address`.\n2. Run the following command to extract the CA certificate of the Artifact Registry\n endpoint and save it to a file called `ar-ca.pem`:\n\n true | openssl s_client -connect \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e-docker.pkg.dev:443 -showcerts 2\u003e/dev/null| sed -ne '/-BEGIN/,/-END/p' \u003e ar-ca.pem\n\n3. Fill in the `privateRegistry` section as follows:\n\n privateRegistry:\n address: \"\u003cvar translate=\"no\"\u003eREGISTRY_ADDRESS\u003c/var\u003e\"\n credentials:\n fileRef:\n path: \"\u003cvar translate=\"no\"\u003eCREDENTIAL_FILE_PATH\u003c/var\u003e\"\n entry: \"private-registry-creds\"\n caCertPath: \"\u003cvar translate=\"no\"\u003eCA_CERT_PATH\u003c/var\u003e\"\n componentAccessServiceAccountKeyPath: \"\u003cvar translate=\"no\"\u003eCOMPONENT_ACCESS_KEY_PATH\u003c/var\u003e\"\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eREGISTRY_ADDRESS\u003c/var\u003e: the `registryUri` value.\n - \u003cvar translate=\"no\"\u003eCREDENTIAL_FILE_PATH\u003c/var\u003e: the full or relative path of the `admin-creds.yaml` file.\n - \u003cvar translate=\"no\"\u003eCA_CERT_PATH\u003c/var\u003e: the full or relative path of the `ar-ca.pem` file.\n - \u003cvar translate=\"no\"\u003eCOMPONENT_ACCESS_KEY_PATH\u003c/var\u003e: the full or relative path of the component access service account key file."]]