gcloud container hub memberships unregister Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud container hub memberships unregister - unregister a cluster from a fleet
- SYNOPSIS
gcloud container hub memberships unregister(MEMBERSHIP_NAME:--location=LOCATION)(--gke-cluster=LOCATION/CLUSTER_NAME|--gke-uri=GKE_URI| [--context=CONTEXT:--kubeconfig=KUBECONFIG])[--uninstall-connect-agent][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
- This command unregisters a cluster with the fleet by:
1.DeletingtheFleetMembershipresourceforthiscluster(a.k.a`gcloudcontainerhubmembershipsdelete`).2.Removingthecorrespondingin-clusterKubernetesResourcesthatmaketheclusterexclusivetoonefleet(a.k.a`kubectldeletemembershipsmembership`).3.[OptionalforGKEcluster]UninstallingtheConnectagentfromthiscluster(a.k.a`kubectldeleteonthegke-connectnamespace`).
The unregister command makes additional internal checks to ensure that all threesteps can be safely done to properly clean-up in-Fleet and in-cluster resources.
To unregister a GKE cluster use
--gke-clusteror--gke-uriflag (no--kubeconfigflag is required).To unregister a third-party cluster use
--contextflag (with anoptional --kubeconfig`s flag).gcloudcontainer hub memberships deleteTo only delete the Fleet Membership resource, consider using the command:
. This command is intended to deletestale Fleet Membership resources as doing so on a fully registered cluster willskip some of the steps above and orphan in-cluster resources and agentconnections to Google. - EXAMPLES
- Unregister a third-party cluster referenced from a specific kubeconfig file:
gcloudcontainerhubmembershipsunregistermy-membership--context=my-cluster-context--kubeconfig=/home/user/custom_kubeconfigUnregister a third-party cluster referenced from the default kubeconfig file:
gcloudcontainerhubmembershipsunregistermy-membership--context=my-cluster-contextUnregister a GKE cluster referenced from a GKE URI:
gcloudcontainerhubmembershipsunregistermy-membership--gke-uri=my-cluster-gke-uriUnregister a GKE cluster referenced from a GKE Cluster location and name:
gcloudcontainerhubmembershipsunregistermy-membership--gke-cluster=my-cluster-region-or-zone/my-clusterUnregister a GKE cluster and uninstall Connect agent:
gcloudcontainerhubmembershipsunregistermy-membership--gke-cluster=my-cluster-region-or-zone/my-cluster--uninstall-connect-agent - POSITIONAL ARGUMENTS
- Membership resource - The group of arguments defining a membership. Thearguments in this group can be used to specify the attributes of this resource.(NOTE) Some attributes are not given arguments in this group but can be set inother ways.
To set the
projectattribute:- provide the argument
MEMBERSHIP_NAMEon the command line with afully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
MEMBERSHIP_NAME- ID of the membership or fully qualified identifier for the membership.
To set the
membershipattribute:- provide the argument
MEMBERSHIP_NAMEon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--location=LOCATION- The location of the membership resource, e.g.
us-central1. If notspecified, defaults toglobal.To set thelocationattribute:- provide the argument
MEMBERSHIP_NAMEon the command line with afully specified name; - provide the argument
--locationon the command line; - set the property
gkehub/location.
- provide the argument
- provide the argument
- Membership resource - The group of arguments defining a membership. Thearguments in this group can be used to specify the attributes of this resource.(NOTE) Some attributes are not given arguments in this group but can be set inother ways.
- REQUIRED FLAGS
- Cluster identifier.
Exactly one of these must be specified:
--gke-cluster=LOCATION/CLUSTER_NAME- The location/name of the GKE cluster. The location can be a zone or a region fore.g
us-central1-a/my-cluster. --gke-uri=GKE_URI- The URI of a GKE cluster that you want to register to Hub; for example,'https://container.googleapis.com/v1/projects/my-project/locations/us-central1-a/clusters/my-cluster'.To obtain the URI, you can run 'gcloud container clusters list --uri'. Note thatthis should only be provided if the cluster being registered is a GKE cluster.The service will validate the provided URI to confirm that it maps to a validGKE cluster."
- Non-GKE cluster identifier.
--context=CONTEXT- The cluster context as it appears in the kubeconfig file. You can get this valuefrom the command line by running command:
kubectl configcurrent-context.This flag argument must be specified if any of the other arguments in this groupare specified.
--kubeconfig=KUBECONFIG- The kubeconfig file containing an entry for the cluster. Defaults to $KUBECONFIGif it is set in the environment, otherwise defaults to $HOME/.kube/config.
- Cluster identifier.
- OPTIONAL FLAGS
--uninstall-connect-agent- If set to True for a GKE cluster, Connect agent will be uninstalled from thecluster. No-op for third-party clusters, where Connect agent will always beuninstalled.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- These variants are also available:
gcloudalphacontainerhubmembershipsunregistergcloudbetacontainerhubmembershipsunregister
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.