第 3 步:启用 API

如需使用 Apigee Hybrid,您必须在 Google Cloud 控制台中为项目启用以下 API:

  • Apigee API:提供您的项目与其他混合服务和 GCP API 之间的通信。
  • Cloud Resource Manager API:混合使用,用于验证服务账号
  • Compute Engine API:用于集群管理(仅限基于 GKE 的集群)
  • Kubernetes Engine API:如果您计划使用 Google Kubernetes Engine (GKE) 或 GKE On-Prem(仅限基于 GKE 的集群)进行混合运行时安装,则启用此 API。

您可以使用 CLI 或 Google Cloud 控制台界面来启用 API。

Google Cloud 界面

要使用界面启用 API,请执行以下步骤:

  1. 打开 Google Cloud 控制台,然后使用您在第 1 步:创建 Google Cloud 账号中创建的账号进行登录。
  2. 选择您在第 2 步:创建 Google Cloud 项目中创建的项目。
  3. 启用 Apigee API:
    1. 选择 API 和服务 > 库。

      API 库视图会显示:

    2. 搜索“Apigee”。

      GCP 会显示与“Apigee”匹配的 API 列表

    3. 找到 Apigee API 服务并点击它。

    4. 点击启用。

      GCP 为您的 GCP 项目启用 Apigee API。

  4. 启用 Cloud Resource Manager API:
    1. 在 API 库视图中,搜索“Cloud Resource Manager”。
    2. 找到 Cloud Resource Manager 服务并点击它。
    3. 点击启用。

      GCP 为 GCP 项目启用了 Cloud Resource Manager API。

  5. (仅限基于 GKE 的集群)启用 Compute Engine API:
    1. 在 API 库视图中,搜索“Compute Engine”。
    2. 找到 Compute Engine API 服务并点击它。
    3. 点击启用。

      Google Cloud 会为您的项目启用 Compute Engine API。

  6. 要确认您已启用 API,请选择 API 和服务 > 信息中心。

    已启用 API 的列表应包含您刚添加的 API,如以下示例所示:

  7. (仅限基于 GKE 的集群)启用 Kubernetes Engine API:
    1. 在 API 库视图中,搜索“Kubernetes Engine”。
    2. 找到 Kubernetes Engine API 服务并点击它。
    3. 点击启用。

      Google Cloud 会为您的项目启用 Kubernetes Engine API。

    4. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。

gcloud CLI

要使用 CLI 启用 API,请执行以下步骤:

  1. 在您用来管理 Apigee 的设备上打开终端窗口。
  2. 使用以下命令定义第 2 步:创建 Google Cloud 项目中的 PROJECT_ID 环境变量:
    export PROJECT_ID=your_project_id
    末尾带有英文句点的项目 ID 名称
  3. 如果要在 Google Cloud (GKE) 中运行集群,而不是在 GKE On-Prem (Anthos) 或 AKS 中运行集群,请使用以下命令启用这些 API:

    gcloud services enable \
        apigee.googleapis.com \
        cloudresourcemanager.googleapis.com \
        compute.googleapis.com \
        container.googleapis.com  --project $PROJECT_ID
    

    对于 GKE On-Prem (Anthos) 或 AKS 安装,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        cloudresourcemanager.googleapis.com  --project $PROJECT_ID
    
  4. 使用以下命令验证是否已启用所有 API:
    gcloud services list

如需详细了解如何在 Google Cloud 控制台中启用 API,请参阅 Cloud 文档中的在 GCP 项目中启用 API。

1 2 3 (下一步)第 4 步:创建组织 5