检查 VPC spoke 的状态

当您提议与 hub 的 Virtual Private Cloud (VPC) spoke 连接时,spoke 将无法完全运行,除非 hub 管理员接受该 spoke。同样,当您提议更新现有 spoke 的属性时,更新只有在 hub 管理员接受后才会生效。本页面介绍如何在提议新 spoke 或针对现有 spoke 的更新后检查 spoke 的状态。

准备工作

开始之前,请查看以下部分。

创建或选择项目

为了更轻松地配置 Network Connectivity Center,请先确定有效项目。

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  8. Make sure that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 如果您使用的是 Google Cloud CLI,请使用 gcloud config set 命令设置项目 ID。

    gcloud config set project PROJECT_ID

    PROJECT_ID 替换为您的唯一项目 ID。

    此页面上的 gcloud CLI 说明假定您已设置项目 ID。

  13. 如需确认您正确设置了项目 ID,请使用 gcloud config list 命令

    gcloud config list --format='text(core.project)'
  14. 启用 Network Connectivity API

    您必须先启用 Network Connectivity API,然后才能使用 Network Connectivity Center 执行任何任务。

    控制台

    如要启用 Network Connectivity API,请执行以下操作:

    1. 在 Google Cloud 控制台中,前往 Network Connectivity Center 页面。

      转到 Network Connectivity Center

    2. 点击启用

    或者,您可以按照启用 API 中所述,使用 Google Cloud 控制台 API 库来启用 API。

    Spoke 状态

    下表介绍了 Spoke 在提交给 Hub 管理员后可能处于的不同状态。

    Spoke 状态 状态原因 说明
    ACTIVE reasons 字段为空。

    对于新的 spoke 提案,这意味着 hub 管理员已接受 spoke 并且 spoke 完全正常运行。

    对于现有 spoke 的更新,这意味着 hub 管理员已接受更新,并且更新已应用。

    ACTIVE UPDATE_PENDING_REVIEW

    这意味着 spoke 正常运行,但提议的针对 spoke 属性的更新尚未被接受或拒绝。如果 spoke 更新被 hub 管理员拒绝,但拒绝失败,则 spoke 可能仍显示 UPDATE_PENDING_REVIEW 状态。

    ACTIVE UPDATE_FAILED

    这意味着 spoke 正常运行,并且提议的针对 spoke 属性的更新已被接受,但更新失败。

    ACTIVE UPDATE_REJECTED

    这意味着 spoke 正常运行,但提议的针对 spoke 属性的更新已被拒绝。

    INACTIVE PENDING_REVIEW

    这意味着 spoke 无法运行,并且 hub 管理员尚未接受或拒绝 spoke。

    INACTIVE REJECTED

    这意味着 Spoke 不起作用,因为 Hub 管理员拒绝了 Spoke。

    OBSOLETE reasons 字段为空。

    这表示该 Hub 已删除。进入此状态后,状态永远不会更改,且 Spoke 只能删除。

    获取 Spoke 提案的状态

    如需获取您在与 hub 不同的项目中提议的 spoke 的状态(包括对现有 spoke 的更新),请按照以下步骤操作。

    gcloud

    运行 gcloud network-connectivity spokes describe 命令

    gcloud network-connectivity spokes describe SPOKE_NAME \
        --global
    

    SPOKE_NAME 替换为您要检查状态的 Spoke 的名称,例如 my-spoke

    API

    如需描述 Spoke,请使用 networkconnectivity.spokes.get 方法

     GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/global/spokes/SPOKE_NAME
    

    请替换以下内容:

    • PROJECT_ID:该 Spoke 所属项目的项目 ID
    • SPOKE_NAME:您要获取状态的 spoke 的名称

    后续步骤