Version 1.7

Registering clusters to the environ

You need to register your GKE on Google Cloud cluster with your project's environ by using Connect. An environ provides a unified way to view and manage multiple clusters and their workloads. You can find out more about environs and the functionality that they enable in our Environs guide.

You don't need to register all your clusters at once, but clusters won't appear on the Anthos Clusters page in the Cloud Console until you register them.

Using the gcloud command-line tool provides you with some more advanced cluster registration options that are not available in the 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

Registering your cluster

  1. Run either of the following commands to register the cluster:

    gcloud beta container hub memberships register MEMBERSHIP_NAME \
     --gke-uri=GKE_URI \
     --enable-workload-identity
    

    or

    gcloud beta container hub 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 on the Hub.
    • GKE_URI: the URI of the GKE cluster, for example: https://container.googleapis.com/projects/my-gke-project/locations/us-central1-a/clusters/my-gke-cluster. You can obtain the URI by running gcloud 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.
  2. Run the following command to grant the required Google Cloud IAM permissions for Connect Agent:

    gcloud projects add-iam-policy-binding \
     HUB_PROJECT_ID \
     --member "serviceAccount:HUB_PROJECT_ID.hub.id.goog[gke-connect/connect-agent-sa]" \
     --role "roles/gkehub.connect"