En este paso, se explica cómo configurar tu entorno de shell y crear un clúster de GKE en tu proyecto de Google Cloud Platform (GCP).
Configura tu shell de la terminal
La herramienta gcloud proporciona la interfaz de línea de comandos principal para GCP y kubectl proporciona la interfaz de línea de comandos principal a fin de ejecutar comandos en clústeres de Kubernetes.
Asegúrate de tener gcloud y kubectl instalados en tu shell local. La herramienta gcloud proporciona la interfaz de línea de comandos principal para GCP y kubectl proporciona la interfaz de línea de comandos principal a fin de ejecutar comandos en clústeres de Kubernetes.
gcloud -hkubectl -h
Si no tienes instaladas estas utilidades, instálalas ahora:
Luego de instalar el SDK de Cloud, instala la herramienta de línea de comandos de kubectl mediante la ejecución del comando siguiente:
gcloud components install kubectl
Usa la herramienta de gcloud para establecer dos opciones de configuración predeterminadas: el proyecto predeterminado y la región de procesamiento.
Establecer esta configuración facilita la ejecución de los comandos de gcloud, ya que gcloud requiere que especifiques el proyecto y la zona de procesamiento en la que deseas trabajar.
Para mostrar una lista de la configuración actual, haz lo siguiente:
gcloud config list
Si un proyecto o una zona de procesamiento no aparece en la lista, debes agregarlos con los comandos que se muestran a continuación. Si, en el resultado de la lista, determinas que necesitas cambiar la configuración actual para reflejar tu proyecto y región de procesamiento (o zona), también puedes usar estos comandos:
gcloud config set project project-idgcloud config set compute/region compute-regiongcloud config set compute/zone compute-zone
En el que project-id es el nombre de tu proyecto de GCP, compute-region es el nombre de una región de procesamiento de GCP y compute-zone es el nombre de una zona de procesamiento de GCP. Por ejemplo: compute/region us-central1. Para obtener una lista de regiones y zonas de procesamiento, consulta Regiones y zonas disponibles.
Crea un clúster de GKE
En este paso, crearás un clúster de Kubernetes en tu proyecto de GCP (el proyecto que configuraste con el comando gcloud config).
Ejecuta el siguiente comando para crear el clúster. El tipo de máquina, la cantidad de nodos y otras opciones de configuración especificadas en el comando crean un clúster de configuración mínima adecuado para una instalación de Apigee Hybrid.
donde cluster-name es el nombre que eliges para el clúster.
La creación del clúster puede tardar unos minutos. Si se ejecuta de forma correcta, verás un resultado similar al siguiente con el estado RUNNING:
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
apigee-hybrid us-central1-a 1.14.10-gke.27 35.222.54.89 n1-standard-4 1.14.10-gke.27 RUNNING
Establece el contexto actual
Un contexto es un grupo de parámetros de acceso. Cada contexto contiene un clúster de Kubernetes, un usuario y un espacio de nombres. El contexto actual es el clúster que predeterminado para kubectl: todos los comandos kubectl se ejecutan en ese clúster.
Asegúrate de que el contexto de gcloud actual esté configurado en el clúster que acabas de crear.
Primero, enumera los contextos para determinar cuál es el contexto actual. En el siguiente ejemplo, el contexto actual es gke_hybrid-project_us-central1-a_apigee-hybrid.
El nombre incluye el nombre de un proyecto de GCP (hybrid-project), una región o zona (us-central1-a) y un nombre de clúster (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
Si es necesario, configura el contexto actual en el clúster que acabas de crear (el clúster en el que quieres instalar Apigee Hybris). Suponiendo que el resultado get-contexts fue como el anterior, si el nombre del clúster que creaste era apigee-cluster en la región us-west1, deberás cambiar al contexto gke_apigee-project_us-west1-a_apigee-cluster, de la siguiente manera:
Las credenciales del clúster te brindan acceso a los contenedores que se ejecutan en el clúster. Recupera tus credenciales y otórgale la función cluster-admin:
Ahora tienes un clúster de Kubernetes en ejecución en su proyecto de GCP. Tu entorno de shell está configurado y estás listo para instalar el software de entorno de ejecución híbrido de Apigee en tu máquina local.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eThis documentation pertains to Apigee hybrid version 1.2, which is end-of-life, and users should upgrade to a newer version.\u003c/p\u003e\n"],["\u003cp\u003eBefore proceeding, users must ensure they have \u003ccode\u003egcloud\u003c/code\u003e and \u003ccode\u003ekubectl\u003c/code\u003e installed, and if not, they need to install them using the provided instructions.\u003c/p\u003e\n"],["\u003cp\u003eUsers should configure their default GCP project and compute region/zone using the \u003ccode\u003egcloud\u003c/code\u003e tool to streamline command execution.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves creating a GKE cluster using a \u003ccode\u003egcloud\u003c/code\u003e command, ensuring the default Kubernetes version meets requirements, and setting the current context to the newly created cluster using \u003ccode\u003ekubectl\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsers must fetch cluster credentials using \u003ccode\u003egcloud\u003c/code\u003e and grant themselves the \u003ccode\u003ecluster-admin\u003c/code\u003e role with a \u003ccode\u003ekubectl\u003c/code\u003e command for access to containers in the cluster.\u003c/p\u003e\n"]]],[],null,["# Step 1: Create a GKE cluster\n\n| You are currently viewing version 1.2 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| **UPGRADING:** If you are upgrading from v1.1.x to v1.2.0, see [Upgrading Apigee hybrid](/apigee/docs/hybrid/v1.2/upgrade) for instructions. If you are performing a new installation, continue with the configurations described below.\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/docs/concepts/sandbox-pods) 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| We recommend you check the default Kubernetes version and make sure it meets the version\n| requirements listed in [Supported platforms](/apigee/docs/hybrid/v1.2/install-before-begin#supported-platforms).\n| To determine which Kubernetes version is the default, use this command: \n|\n| ```\n| gcloud container get-server-config\n| ```\n|\n|\n| If you don't want to use the default, you can add the `--cluster-version` flag to the cluster\ncreation command. For details, see [gcloud container clusters create.](https://cloud.google.com/sdk/gcloud/reference/container/clusters/create) \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.14.10-gke.27 35.222.54.89 n1-standard-4 1.14.10-gke.27 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.2/install-create-cluster) [(NEXT) Step 2: Install apigeectl](/apigee/docs/hybrid/v1.2/install-download-install) [3](/apigee/docs/hybrid/v1.2/install-copy-overrides) [4](/apigee/docs/hybrid/v1.2/install-apply-hybrid)\n\n\u003cbr /\u003e"]]