Das in dieser Dokumentation beschriebene Produkt Anthos-Cluster in AWS (vorherige Generation) befindet sich jetzt im Wartungsmodus. Alle neuen Installationen müssen Anthos-Cluster in AWS der aktuellen Generation verwenden.
Verbindung zum Cluster über die Google Cloud Console herstellen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mit Connect können Sie die Google Cloud Console verwenden, um Ihre Nutzercluster zu verwalten. Jeder von Ihnen erstellte Nutzercluster führt automatisch den Connect Agent aus und ist bei Connect registriert. Weitere Informationen finden Sie in der Connect-Übersicht.
Hinweise
Bevor Sie GKE on AWS verwenden, müssen die folgenden Bedingungen erfüllt sein:
Wählen Sie den Cluster aus. Der Bildschirm Kubernetes-Clusterdetails wird angezeigt.
Klicken Sie auf die Schaltfläche Anmelden.
Wählen Sie Token aus und fügen Sie das zuvor in die Zwischenablage kopierte Kubernetes-Token ein.
Klicken Sie auf "Anmelden".
Cluster registrieren
Damit mehrere Cluster nicht mit demselben Namen eine Verbindung zu Connect herstellen können, registrieren Sie den Cluster über die Google Cloud CLI. Wenn Sie einen Cluster registrieren, müssen Sie das Google Cloud CLI im selben Netzwerk wie Ihren Cluster ausführen.
Registrieren Sie den Cluster mit folgendem Befehl:
MEMBERSHIP_NAME ist der Name der Mitgliedschaft, den Sie auswählen und der eindeutig dem Cluster entspricht, der für die Flotte registriert wird.
SERVICE_ACCOUNT_KEY_PATH ist der lokale Dateipfad zur JSON-Datei des privaten Schlüssels des Dienstkontos, die als Teil der Voraussetzungen heruntergeladen wurde.
Dieser Dienstkontoschlüssel wird als Secret mit dem Namen creds-gcp im Namespace gke-connect gespeichert.
KUBECONFIG_CONTEXT: der Clusterkontext des zu registrierenden Clusters, wie er in der Datei "kubeconfig" angezeigt wird. Sie erhalten diesen Wert über die Befehlszeile, indem Sie kubectl config current-context ausführen.
KUBECONFIG_PATH ist der lokale Dateipfad, in dem das kubeconfig mit einem Eintrag für den registrierten Cluster gespeichert ist.
Dies ist der Standardwert $KUBECONFIG, wenn diese Umgebungsvariable gesetzt ist; andernfalls ist dies der Standardwert für $HOME/.kube/config.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-22 (UTC)."],[],[],null,["With Connect, you can use the Google Cloud console to manage your\nuser clusters. Each user cluster that you create automatically runs the\nConnect Agent and is registered with Connect. For more\ninformation, see\n[Connect overview](/anthos/multicluster-management/connect/overview).\n\nBefore you begin\n\n\nBefore you start using GKE on AWS, make sure you have performed the following tasks:\n\n- Complete the [Prerequisites](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/prerequisites).\n\n\u003c!-- --\u003e\n\n- Install a [management service](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/installing-management).\n- Create a [user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-user-cluster).\n\nLogging into your cluster with Connect\n\nYou can use the Google Cloud console to view, monitor, debug, and manage workloads\non your user clusters.\n\nTo log into your user clusters:\n\n1. From your `anthos-aws` directory, use\n `anthos-gke` to switch context to your user cluster.\n\n ```sh\n cd anthos-aws\n env HTTPS_PROXY=http://localhost:8118 \\\n anthos-gke aws clusters get-credentials CLUSTER_NAME\n ```\n Replace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with your user cluster name.\n\n \u003cbr /\u003e\n\n2. From a command line, use `kubectl` to set up a\n [Kubernetes service account](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/)\n and a token in the `kube-system` namespace.\n\n This topic assumes the name of the service account is `admin-user`. \n\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl create serviceaccount -n kube-system admin-user\n\n3. Create a service account token Secret with `kubectl`.\n\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl apply -n kube-system -f - \u003c\u003c EOF\n apiVersion: v1\n kind: Secret\n metadata:\n name: admin-user-token\n annotations:\n kubernetes.io/service-account.name: admin-user\n type: kubernetes.io/service-account-token\n EOF\n\n4. Create a ClusterRoleBinding between the `cluster-admin` role and\n the Kubernetes service account.\n\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl create clusterrolebinding admin-user-binding \\\n --clusterrole cluster-admin --serviceaccount kube-system:admin-user\n\n5. Get the service account's Secret with `kubectl`.\n\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl get secret -n kube-system admin-user-token -o jsonpath='{$.data.token}' \\\n | base64 -d | sed $'s/$/\\\\\\n/g'\n\n6. Copy the secret to your clipboard.\n\n7. 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)\n8. Select the cluster. The **Kubernetes cluster details** screen appears.\n\n9. Click the **Login** button.\n\n10. Select **Token** and paste the Kubernetes token you copied earlier.\n Click Login.\n\nRegister your cluster **Note:** The following section only applies to cluster versions 1.21 and lower.\n\nTo prevent multiple clusters from registering to Connect with the same\nname, you register the cluster through Google Cloud CLI. When you register a\ncluster, you must run the Google Cloud CLI from the same network as your cluster.\nTo register your cluster, run the following command: \n\n```\n gcloud container fleet memberships register MEMBERSHIP_NAME \\\n --context=KUBECONFIG_CONTEXT \\\n --kubeconfig=KUBECONFIG_PATH \\\n --service-account-key-file=SERVICE_ACCOUNT_KEY_PATH\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e: the membership name that you choose and that is used to uniquely represent the cluster being registered to the fleet.\n- \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_KEY_PATH\u003c/var\u003e: the local filepath to the service account's private key JSON file downloaded as part of Prerequisites. This service account key is stored as a secret named `creds-gcp` in the `gke-connect` namespace.\n- \u003cvar translate=\"no\"\u003eKUBECONFIG_CONTEXT\u003c/var\u003e: the cluster context of the cluster being registered as it appears in the kubeconfig file. You can get this value from the command line by running `kubectl config current-context`.\n- \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e: the local filepath where your kubeconfig containing an entry for the cluster being registered is stored. This defaults to `$KUBECONFIG` if that environment variable is set; otherwise, this defaults to `$HOME/.kube/config`.\n\nWhat's next\n\nRead the full documentation on\n[Logging into clusters](/anthos/multicluster-management/console/logging-in)\nwith Connect.\n\nLearn about multi-cluster management with\n[Connect](/anthos/multicluster-management/connect/overview)."]]