Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment annuler manuellement l'enregistrement d'un cluster d'un parc Google Cloud .
Lorsque vous annulez manuellement l'enregistrement d'un cluster, sa connexion au parc est supprimée, mais le cluster reste disponible. La suppression d'un cluster GKE enregistré sur Google Cloud à l'aide de la console Google Cloud ou de gcloud CLI supprime également l'appartenance au parc du cluster.
Vous ne pouvez annuler l'enregistrement que des clusters GKE sur Google Cloud et des clusters tiers associés. L'enregistrement des autres types de clusters ne peut pas être annulé.
Notez qu'à l'heure actuelle, il n'est pas recommandé de déplacer des clusters enregistrés entre des parcs (d'annuler l'enregistrement, puis de procéder au réenregistrement), car cela peut entraîner un comportement inattendu ou indésirable. Par exemple, l'identité de charge de travail du parc correspondant à votre charge de travail peut changer, ce qui peut entraîner des blocages de requêtes et des interruptions. L'approche recommandée consiste à créer un cluster dans le parc contenant vos charges de travail, puis à déplacer vos charges de travail de l'ancien cluster vers le nouveau.
Annuler l'enregistrement d'un cluster
gcloud
Annuler l'enregistrement d'un cluster GKE
Cette commande ne peut être utilisée que pour annuler l'enregistrement des clusters GKE enregistrés à l'aide de gcloud container clusters update ou gcloud container clusters create.
[MEMBERSHIP_NAME] est le nom de l'abonnement correspondant au cluster. Pour répertorier tous les abonnements sur le Hub, exécutez la commande suivante : gcloud container fleet memberships list.
[GKE_URI] est l'URI du cluster GKE (par exemple, "https://container.googleapis.com/projects/my-project/locations/us-central1-a/clusters/my-cluster").
Vous pouvez obtenir l'URI en exécutant la commande gcloud container clusters list --uri.
L'URI fourni sera validé afin de confirmer qu'il est mappé au cluster GKE valide.
[GKE_CLUSTER] est l'emplacement (location/name) du cluster GKE. L'emplacement peut être une zone ou une région (par exemple, us-central1-a/my-cluster).
Annuler l'enregistrement d'un cluster associé
Ces instructions s'appliquent aux clusters enregistrés à l'aide de la dernière version de la fonctionnalité de clusters associés. Les clusters associés à l'aide de la génération précédente (obsolète) de cette fonctionnalité doivent utiliser l'ancienne commande présentée dans la section suivante.
[MEMBERSHIP_NAME] est le nom de l'abonnement correspondant au cluster. Pour obtenir la liste de tous les abonnements sur le Hub, exécutez la commande suivante : gcloud container fleet memberships list.
[KUBECONFIG_PATH] est le chemin d'accès à l'emplacement local du fichier kubeconfig contenant une entrée pour le fichier du cluster.
La valeur par défaut est $KUBECONFIG si cette variable d'environnement est définie, ou $HOME/.kube/config par défaut.
[KUBECONFIG_CONTEXT] correspond au contexte du cluster tel qu'il apparaît dans le fichier "kubeconfig". Vous pouvez obtenir cette valeur depuis la ligne de commande en exécutant kubectl config current-context.
Console
Annuler l'enregistrement d'un cluster GKE sur Google Cloud
Pour annuler l'enregistrement d'un cluster GKE, procédez comme suit :
Accédez à la page Clusters GKE. Cette page affiche tous vos clusters.
Sélectionnez le projet Google Cloud dans lequel se trouve le cluster.
Cliquez sur le nom du cluster que vous souhaitez dissocier, puis sélectionnez Afficher plus de détails dans le panneau latéral.
En haut de la fenêtre, cliquez sur delete
Supprimer.
Lorsque vous êtes invité à confirmer l'opération, saisissez le nom du cluster, puis cliquez sur Confirmer.
Terraform
Pour annuler l'enregistrement d'un cluster GKE que vous avez enregistré à l'aide de Terraform, procédez comme suit :
Supprimez le bloc suivant de la configuration de la ressource google_container_cluster du cluster :
fleet {
project = "FLEET_HOST_PROJECT""
}
FLEET_HOST_PROJECT correspond à l'ID du projet Google Cloud dans lequel votre cluster est enregistré.
Gérer l'agent Connect
Les étapes suivantes s'appliquent uniquement à l'annulation de l'enregistrement des clusters associés, où l'agent Connect est installé sur le cluster dans le cadre de l'enregistrement.
Facultatif : Vérifier que l'espace de noms de l'agent Connect est supprimé
Après avoir supprimé l'enregistrement d'un cluster, vous pouvez vérifier que l'espace de noms utilisé par Connect Agent a bien été supprimé. Cela s'applique uniquement aux enregistrements qui installent l'agent Connect. Pour cela, saisissez la commande :
kubectl get ns -l hub.gke.io/project
Si cette commande ne renvoie aucun résultat, l'espace de noms a déjà été supprimé.
Supprimer le compte de service de l'agent Connect
Si vous avez créé un compte de service pour l'agent Connect, vous pouvez le supprimer comme suit :
gcloud iam service-accounts delete [SERVICE_ACCOUNT_NAME]
Annuler l'enregistrement d'un cluster non disponible
Pour annuler l'enregistrement d'un cluster auquel vous n'avez plus accès, procédez comme suit :
Répertoriez les clusters (appelés abonnements) actuellement enregistrés :
gcloud container fleet memberships list
Dans le résultat de la commande, la colonne Name répertorie le nom des abonnements des clusters enregistrés, tandis que la colonne EXTERNAL_ID répertorie les identifiants uniques des clusters de l'espace de noms kube-system.
Pour annuler l'enregistrement d'un cluster indisponible, exécutez la commande suivante :
où [MEMBERSHIP_NAME] est le nom de l'abonnement correspondant au cluster.
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/01 (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/01 (UTC)."],[],[],null,["This page describes how to manually unregister a cluster from a Google Cloud fleet.\nWhen you manually unregister a cluster, its connection to the fleet is\nremoved but the cluster remains. [Deleting a registered GKE cluster on Google Cloud](/kubernetes-engine/docs/how-to/deleting-a-cluster) using either the Google Cloud console or gcloud CLI also deletes the cluster's fleet membership.\n\nYou can unregister GKE clusters on Google Cloud and attached\nthird-party clusters only. Other cluster types can't be unregistered.\n\nNote that moving registered clusters between fleets (unregistering then\nreregistering) is not recommended, as it can result in unexpected\nor unwanted behavior: for example, your workloads' fleet Workload Identity\nwill change, potentially resulting in blocked requests and outages. The\nrecommended approach is to create a new cluster in the fleet in which you\nwant your workloads to reside, then move your workloads from your old cluster\nto the new cluster.\n\nUnregister a cluster \n\ngcloud\n\nUnregister a GKE cluster\n\nThis command can only be used to unregister GKE clusters registered using `gcloud container clusters update` or `gcloud container clusters create`.\n\nRun the following command: \n\n```\ngcloud container clusters update CLUSTER_NAME --clear-fleet-project\n```\n\nReplace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the cluster's name you want to delete.\n\nUnregister a GKE cluster (legacy command)\n\nIf you registered a cluster using the older `register` command, run either of the following commands to unregister it: \n\n```\ngcloud container fleet memberships unregister [MEMBERSHIP_NAME] \\\n --project=[PROJECT_ID] \\\n --gke-uri=[GKE_URI]\n``` \n\n```\ngcloud container fleet memberships unregister [MEMBERSHIP_NAME] \\\n --project=[PROJECT_ID] \\\n --gke-cluster=[GKE_CLUSTER]\n```\n\nwhere:\n\n- \u003cvar translate=\"no\"\u003e[PROJECT_ID]\u003c/var\u003e is your Google Cloud project ID. [Learn how to find\n this value](/resource-manager/docs/creating-managing-projects#identifying_projects).\n- \u003cvar translate=\"no\"\u003e[MEMBERSHIP_NAME]\u003c/var\u003e is the membership name that corresponds to your cluster. To list all the memberships on the Hub, run: `gcloud container fleet memberships list`.\n- \u003cvar translate=\"no\"\u003e[GKE_URI]\u003c/var\u003e is the URI of the GKE cluster, for example: 'https://container.googleapis.com/projects/my-project/locations/us-central1-a/clusters/my-cluster'. You can obtain the URI by running `gcloud container clusters list --uri`. The provided URI will be validated to confirm that it maps to the valid GKE cluster.\n- \u003cvar translate=\"no\"\u003e[GKE_CLUSTER]\u003c/var\u003e is the `location/name` of the GKE cluster. The location can be a zone or a region for example: `us-central1-a/my-cluster`.\n\nUnregister an attached cluster\n\nThese instructions apply to clusters registered using the latest version of our attached clusters feature. Clusters attached using the deprecated previous generation of this feature should use the legacy command in the next section.\n\n- [Detach an EKS cluster](/anthos/clusters/docs/multi-cloud/attached/eks/how-to/detach-cluster)\n- [Detach an AKS cluster](/anthos/clusters/docs/multi-cloud/attached/aks/how-to/detach-cluster)\n- [Detach another attached cluster type](/anthos/clusters/docs/multi-cloud/attached/generic/how-to/detach-cluster)\n\nUnregister an attached cluster (legacy command)\n\nIf you registered a cluster using the previous generation of attached clusters, run the following command to unregister it: \n\n```\ngcloud container fleet memberships unregister [MEMBERSHIP_NAME] \\\n --project=[PROJECT_ID] \\\n --context=[KUBECONFIG_CONTEXT] \\\n --kubeconfig=[KUBECONFIG_PATH]\n```\n\nwhere:\n\n- \u003cvar translate=\"no\"\u003e[PROJECT_ID]\u003c/var\u003e is your Google Cloud project ID. [Learn how to find\n this value](/resource-manager/docs/creating-managing-projects#identifying_projects).\n- \u003cvar translate=\"no\"\u003e[MEMBERSHIP_NAME]\u003c/var\u003e is the membership name that corresponds to your cluster. To get list of all the memberships on the Hub, run: `gcloud container fleet memberships list`.\n- \u003cvar translate=\"no\"\u003e[KUBECONFIG_PATH]\u003c/var\u003e is the local path where your kubeconfig containing an entry for the cluster file is stored. This defaults to `$KUBECONFIG` if that environment variable is set, otherwise this defaults to `$HOME/.kube/config`.\n- \u003cvar translate=\"no\"\u003e[KUBECONFIG_CONTEXT]\u003c/var\u003e is the cluster's context as it appears in the kubeconfig file. You can get this value from the command line by running `kubectl config current-context`.\n\nConsole\n\nUnregister a GKE cluster on Google Cloud\n\nTo unregister a GKE cluster:\n\n1. Go to the **GKE Clusters** page. This\n page shows all your clusters.\n\n [Go to the GKE Clusters page](https://console.cloud.google.com/kubernetes/list/overview)\n2. Click more_vert **Actions** next to the cluster in the list that you want to unregister.\n\n3. In the Actions menu, select **Unregister**.\n\n4. In the dialog that displays, type the name of the cluster and click **Unregister** to confirm the action.\n\nUnregister an attached third-party cluster\n\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\n\u003cbr /\u003e\n\nTo unregister an attached cluster:\n\n1. In the Google Cloud console, go to the **Google Kubernetes Engine clusters\n overview** page.\n\n [Go to GKE clusters](https://console.cloud.google.com/kubernetes/list/overview)\n2. Select the Google Cloud project that the cluster is in.\n\n3. Click the name of the cluster you want to detach, and then select\n **View more details** in the side panel.\n\n4. Near the top of the window, click delete **Delete**.\n\n5. When prompted to confirm, enter the name of the cluster and\n click **Confirm**.\n\nTerraform\n\nTo unregister a GKE cluster that you registered using Terraform:\n\nDelete the following block from the `google_container_cluster` resource configuration of the cluster: \n\n fleet {\n project = \u003cvar translate=\"no\"\u003e\"FLEET_HOST_PROJECT\"\u003c/var\u003e\"\n }\n\n\u003cvar translate=\"no\"\u003eFLEET_HOST_PROJECT\u003c/var\u003e is the Google Cloud project ID your cluster is registered to.\n\nManage the Connect Agent\n\nThe following steps apply only to unregistering attached clusters, where the Connect Agent is installed on the cluster as part of registration.\n\nOptional: Verify that the Connect Agent namespace is deleted\n\nAfter you unregister a cluster, you can verify that the namespace used by the\nConnect Agent has been deleted. This applies to registrations that install the Connect Agent only. To do so, run: \n\n```\nkubectl get ns -l hub.gke.io/project\n```\n\nIf this command returns no output, the namespace has already been deleted.\n\nDelete the Connect Agent Service Account\n\nIf you created a service account for the Connect Agent, you can delete it as follows: \n\n```\ngcloud iam service-accounts delete [SERVICE_ACCOUNT_NAME]\n```\n\nUnregister an unavailable cluster\n\nIf you want to unregister a cluster that you can no longer access, perform\nthe following steps:\n\n1. List the clusters (a.k.a memberships) that are currently registered:\n\n ```\n gcloud container fleet memberships list\n ```\n\n In the command output, the `Name` column lists the membership names of registered\n clusters, and the `EXTERNAL_ID` column lists the clusters' UIDs of the kube-system\n namespace.\n2. To unregister an unavailable cluster, run the following command:\n\n ```\n gcloud container fleet memberships delete [MEMBERSHIP_NAME]\n ```\n\n where \u003cvar translate=\"no\"\u003e[MEMBERSHIP_NAME]\u003c/var\u003e is the membership name that corresponds to\n your cluster."]]