In diesem Schritt wird erläutert, wie Sie Ihre Shell-Umgebung einrichten und einen GKE-Cluster in Ihrem GCP(Google Cloud Platform)-Projekt erstellen.
Terminal-Shell einrichten
Das gcloud-Tool ist die primäre Befehlszeile für die GCP und kubectl die primäre Befehlszeile zum Ausführen von Befehlen für Kubernetes-Cluster.
Achten Sie darauf, dass gcloud und kubectl in Ihrer lokalen Shell installiert sind. Das gcloud-Tool ist die primäre Befehlszeile für die GCP und kubectl die primäre Befehlszeile zum Ausführen von Befehlen für Kubernetes-Cluster.
gcloud -hkubectl -h
Wenn diese Dienstprogramme nicht installiert sind, installieren Sie sie jetzt:
Installieren Sie nach der Installation des Cloud SDK das kubectl-Befehlszeilentool mit folgendem Befehl:
gcloud components install kubectl
Mit dem gcloud-Tool können Sie zwei Standardeinstellungen konfigurieren: Ihr Standardprojekt und die Computing-Region.
Wenn Sie diese Einstellungen konfigurieren, erleichtert dies die Ausführung von gcloud-Befehlen, da Sie für gcloud das Projekt und die Computing-Zone angeben müssen, in denen Sie arbeiten möchten.
So listen Sie die aktuellen Einstellungen auf:
gcloud config list
Wenn ein Projekt und/oder eine Computing-Zone nicht aufgeführt ist, müssen Sie diese mit den unten aufgeführten Befehlen hinzufügen. Wenn Sie in der Listenausgabe feststellen, dass Sie die aktuellen Einstellungen entsprechend Ihrem Projekt und Ihrer Computing-Region (oder -Zone) ändern müssen, können Sie auch diese Befehle verwenden:
gcloud config set project project-idgcloud config set compute/region compute-regiongcloud config set compute/zone compute-zone
Dabei ist project-id der Name Ihres GCP-Projekts, compute-region der Name einer GCP-Computing-Region und compute-zone der Name einer GCP-Computing-Zone. Beispiel: compute/region us-central1. Eine Liste der Computing-Regionen und -Zonen finden Sie unter Verfügbare Regionen und Zonen.
GKE-Cluster erstellen
In diesem Schritt erstellen Sie einen Kubernetes-Cluster in Ihrem GCP-Projekt (dem Projekt, das Sie mit dem Befehl gcloud config festgelegt haben).
Führen Sie den folgenden Befehl aus, um den Cluster zu erstellen. Der im Befehl angegebene Maschinentyp, die Anzahl der Knoten und andere Einstellungen erstellen einen minimal konfigurierten Cluster, der sich für eine Apigee Hybrid-Testinstallation eignet:
Dabei steht cluster-name für den Namen, den Sie für den Cluster auswählen.
Die Erstellung eines Clusters kann einige Minuten dauern. Bei Erfolg wird eine Ausgabe wie die folgende mit dem Status RUNNING angezeigt:
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
apigee-hybrid us-central1-a 1.13.11-gke.9 35.222.54.89 n1-standard-4 1.13.11-gke.9 3 RUNNING
Aktuellen Kontext festlegen
Ein Kontext ist eine Gruppe von Zugriffsparametern. Jeder Kontext enthält einen Kubernetes-Cluster, einen Nutzer und einen Namespace. Der aktuelle Kontext ist der Cluster, der derzeit als Standard für kubectl gilt: alle kubectl-Befehle werden für diesen Cluster ausgeführt.
Achten Sie darauf, dass der aktuelle Kontext gcloud auf den soeben erstellten Cluster eingestellt ist.
Listen Sie zuerst die Kontexte auf, um den aktuellen Kontext zu ermitteln. Im folgenden Beispiel lautet der aktuelle Kontext gke_hybrid-project_us-central1-a_apigee-hybrid.
Der Name enthält den Namen eines GCP-Projekts (hybrid-project), eine Region oder Zone (us-central1-a) und einen Clusternamen (apigee-hybrid):
kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* gke_hybrid-project_us-central1-a_apigee-hybrid gke_hybrid-project_us-central1-a_apigee-hybrid gke_hybrid-project_us-central1-a_apigee-hybrid
gke_apigee-project_us-west1-a_apigee-cluster gke_apigee-project_us-west1-a_apigee-cluster gke_apigee-project_us-west1-a_apigee-cluster
Legen Sie gegebenenfalls den aktuellen Kontext auf den soeben erstellten Cluster fest (den Cluster, in dem Sie Apigee Hybrid installieren möchten). Wenn nach der vorherigen Ausgabe get-contexts der von Ihnen erstellte Clustername apigee-cluster in der Region us-west1 lautet, wechseln Sie so zum Kontext gke_apigee-project_us-west1-a_apigee-cluster:
Clusteranmeldedaten gewähren Ihnen Zugriff auf die Container, die im Cluster ausgeführt werden. Rufen Sie Ihre Anmeldedaten ab und gewähren Sie sich selbst die Rolle cluster-admin:
Sie haben jetzt einen Kubernetes-Cluster in Ihrem GCP-Projekt ausgeführt. Ihre Shell-Umgebung ist eingerichtet und Sie können die Apigee Hybrid-Software auf Laufzeitebene auf Ihrem lokalen Rechner installieren.
[[["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-08-28 (UTC)."],[[["\u003cp\u003eThis guide provides instructions for setting up a shell environment and creating a Google Kubernetes Engine (GKE) cluster in a Google Cloud Platform (GCP) project, which is required for a trial Apigee hybrid installation.\u003c/p\u003e\n"],["\u003cp\u003eUsers must ensure they have both the \u003ccode\u003egcloud\u003c/code\u003e and \u003ccode\u003ekubectl\u003c/code\u003e command-line tools installed and configured, including setting the default project and compute region or zone using the \u003ccode\u003egcloud config\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eA GKE cluster is created using the \u003ccode\u003egcloud container clusters create\u003c/code\u003e command, and the guide provides settings to create a minimally configured cluster suitable for a trial installation, while also warning that Apigee does not support GKE Sandbox or gVisor.\u003c/p\u003e\n"],["\u003cp\u003eAfter cluster creation, the current context for \u003ccode\u003ekubectl\u003c/code\u003e commands must be set to the newly created cluster to ensure that all subsequent commands are executed against it, using \u003ccode\u003ekubectl config use-context\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eFinally, the guide explains how to fetch cluster credentials using \u003ccode\u003egcloud container clusters get-credentials\u003c/code\u003e and how to grant the cluster-admin role to the user with \u003ccode\u003ekubectl create clusterrolebinding\u003c/code\u003e, in order to have the adequate access to the cluster.\u003c/p\u003e\n"]]],[],null,["# Step 1: Create a GKE cluster\n\n| You are currently viewing version 1.1 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\n\nThis step explains how to set up your shell environment and create a GKE cluster\nin your Google Cloud Platform (GCP) project.\n\nSet up your terminal shell\n--------------------------\n\nThe `gcloud` tool provides the primary command-line interface\nfor GCP, and `kubectl` provides the primary command-line interface for\nrunning commands against Kubernetes clusters.\n\n1. Be sure you have `gcloud` and `kubectl` installed in your\n local shell. The `gcloud` tool provides the primary command-line interface\n for GCP, and `kubectl` provides the primary command-line interface for\n running commands against Kubernetes clusters.\n\n gcloud -h\n kubectl -h\n\n2. If you do not have these utilities installed, install them now:\n 1. [Install the Cloud SDK](https://cloud.google.com/sdk/install), which includes the `gcloud` command-line tool.\n 2. After installing Cloud SDK, install the `kubectl` command-line tool by running the following command: \n\n ```\n gcloud components install kubectl\n ```\n3. Use the `gcloud` tool to configure two default settings: your default [project](https://cloud.google.com/resource-manager/docs/creating-managing-projects) and [compute region](https://cloud.google.com/compute/docs/regions-zones/#available). Configuring these settings makes it easier to run `gcloud` commands, because `gcloud` requires that you specify the project and compute zone in which you want to work.\n\n\n To list the current settings: \n\n ```\n gcloud config list\n ```\n\n\n If a project and/or compute zone is not listed, then you need to add them with the\n commands shown below. If, from the list output, you determine that you need to switch the current settings\n to reflect your project and compute region (or zone), you can also use these commands: \n\n gcloud config set project \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e\n gcloud config set compute/region \u003cvar translate=\"no\"\u003ecompute-region\u003c/var\u003e\n gcloud config set compute/zone \u003cvar translate=\"no\"\u003ecompute-zone\u003c/var\u003e\n\n\n Where \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e is the name of your GCP project, \u003cvar translate=\"no\"\u003ecompute-region\u003c/var\u003e is\n the name of a GCP compute region, and \u003cvar translate=\"no\"\u003ecompute-zone\u003c/var\u003e is\n the name of a GCP compute zone. For example: `compute/region us-central1`. For a list of\n compute regions and zones, see [Available regions and zones](https://cloud.google.com/compute/docs/regions-zones/#available).\n\nCreate a GKE cluster\n--------------------\n\n| **Note:** Apigee does not support [GKE Sandbox](https://cloud.google.com/kubernetes-engine/sandbox) or [gVisor](https://github.com/google/gvisor).\n\n\nIn this step, you will create a Kubernetes cluster in your GCP project (the project you set\nwith the `gcloud config` command).\n| **NOTE:** The following command assumes you set the `gcloud` configuration for the compute region and/or zone, as explained in the previous steps. If you did not set the configuration, then you will need to add the `--region \"`\u003cvar translate=\"no\"\u003ecompute-region\u003c/var\u003e`\"` and/or `--zone \"`\u003cvar translate=\"no\"\u003ecompute-zone\u003c/var\u003e`\"` parameter to the command.\n\n\nExecute the following command to create the cluster. The machine type, number of nodes, and\nother settings specified in the command create a minimally configured cluster suitable for\na trial Apigee hybrid installation: \n\n```\ngcloud container clusters create cluster-name \\\n--machine-type \"n1-standard-4\" --num-nodes \"3\" --enable-autoscaling --min-nodes \"3\" --max-nodes \"6\"\n```\n\n\nWhere \u003cvar translate=\"no\"\u003ecluster-name\u003c/var\u003e is the name you choose for the cluster.\n\n\nCluster creation can take a few minutes. Upon success, you will see output similar to\nthe following with a status of `RUNNING`: \n\n```\nNAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS\napigee-hybrid us-central1-a 1.13.11-gke.9 35.222.54.89 n1-standard-4 1.13.11-gke.9 3 RUNNING\n```\n\nSet the current context\n-----------------------\n\n\nA *context* is a group of access parameters. Each context contains a Kubernetes cluster,\na user and a namespace. The current context is the cluster that is currently the default for\n`kubectl`: all `kubectl` commands run against that cluster.\n\n\nMake sure the current `gcloud` context is set to the cluster you just created.\n\n1. First, list the contexts to determine which is the *current* context. In the following example, the current context is `gke_hybrid-project_us-central1-a_apigee-hybrid`. The name includes the name of a GCP project (`hybrid-project`), a region or zone (`us-central1-a`), and a cluster name (`apigee-hybrid`): \n\n ```\n kubectl config get-contexts\n CURRENT NAME CLUSTER AUTHINFO NAMESPACE\n * gke_hybrid-project_us-central1-a_apigee-hybrid gke_hybrid-project_us-central1-a_apigee-hybrid gke_hybrid-project_us-central1-a_apigee-hybrid\n gke_apigee-project_us-west1-a_apigee-cluster gke_apigee-project_us-west1-a_apigee-cluster gke_apigee-project_us-west1-a_apigee-cluster\n\n ```\n2. If necessary, set the current context to the cluster you just created (the cluster into which you intend to install Apigee hybrid). Assuming the previous `get-contexts` output, if the cluster name you created were `apigee-cluster` in the region `us-west1`, you would switch to the `gke_apigee-project_us-west1-a_apigee-cluster` context, as follows: \n\n ```\n kubectl config use-context gke_apigee-project_us-west1-a_apigee-cluster\n ```\n\n Where `gke_apigee-project_us-west1-a_apigee-cluster` is the name of the context to switch to.\n3. Check the current context to be sure it is set to the intended cluster. For example: \n\n ```\n kubectl config current-context\n gke_apigee-project_us-west1-a_apigee-cluster\n ```\n\nGrant cluster credentials\n-------------------------\n\n\n[Cluster credentials](https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials) give you access to the containers running in the cluster. Fetch your\ncredentials and grant yourself the **cluster-admin** role:\n\n1. Fetch the credentials: \n\n ```\n gcloud container clusters get-credentials cluster-name\n ```\n\n Where \u003cvar translate=\"no\"\u003ecluster-name\u003c/var\u003e is the name is the name of the cluster you created (the\n cluster into which you intend to install Apigee hybrid).\n2. Set the cluster role binding. Execute this command exactly as shown: \n\n ```\n kubectl create clusterrolebinding cluster-admin-binding \\\n --clusterrole cluster-admin --user $(gcloud config get-value account)\n ```\n\nSummary\n-------\n\n\nYou now have a Kubernetes cluster running in your GCP project. Your shell environment is\nset up, and you are ready to install the Apigee hybrid runtime plane software\non your local machine.\n[1](/apigee/docs/hybrid/v1.1/install-create-cluster) [(NEXT) Step 2: Install apigeectl](/apigee/docs/hybrid/v1.1/install-download-install) [3](/apigee/docs/hybrid/v1.1/install-copy-overrides) [4](/apigee/docs/hybrid/v1.1/install-apply-hybrid)\n\n\u003cbr /\u003e"]]