You need to register your GKE cluster with your project's fleet by using Connect. A fleet provides a unified way to view and manage multiple clusters and their workloads. You can find out more about fleets and the functionality that they enable in our Fleets guide.
You don't need to register all your clusters at once, but clusters won't appear on the Anthos Clusters page in the Google Cloud console until you register them.
Using the Google Cloud CLI provides you with some more advanced cluster registration options that are not available in the Google Cloud console, including downloading and applying the Connect Agent manifest yourself. To find out more about these options, see advanced registration options in the Connect documentation.
Before you begin
Make sure you have the required permissions to register the cluster.
Make sure your fleet host project has the required APIs enabled to register the cluster.
Registering your cluster
gcloud
Ensure that the cluster has GKE Workload Identity enabled, following the instructions in our prerequisites.
Run either of the following commands to register the cluster:
gcloud container fleet memberships register MEMBERSHIP_NAME \ --gke-uri=GKE_URI \ --enable-workload-identity
or
gcloud container fleet memberships register MEMBERSHIP_NAME \ --gke-cluster=GKE_CLUSTER \ --enable-workload-identity
Replace the following:
- MEMBERSHIP_NAME: the membership name that you choose to uniquely represent the cluster being registered to the fleet.
- GKE_URI: the URI of the GKE cluster,
for example:
https://container.googleapis.com/v1/projects/my-gke-project/locations/us-central1-a/clusters/my-gke-cluster
. You can obtain the URI by runninggcloud container clusters list --uri
. - GKE_CLUSTER: the
location/name
of the GKE cluster from the current project. The location can be a zone or a region, for example:us-central1-a/my-gke-cluster
.
If you want to install the Connect Agent on the cluster, add the optional
--install-connect-agent
flag to either command, as in the following example. By default (without this flag) the agent is not installed.gcloud container fleet memberships register MEMBERSHIP_NAME \ --gke-cluster=GKE_CLUSTER \ --enable-workload-identity \
--install-connect-agent
What's next
- Learn more about the gcloud container hub command group.