列出 `Route` 資源

本文件適用於使用服務路由 API 設定服務網格的網格管理員。

在服務路由 API 模型中,Route 資源會附加至 MeshGateway 資源。在設定中,MeshGateway 資源會參照一或多個 Route 資源。

如果您是 MeshGateway 資源的擁有者,可以列出附加至 MeshGatewayRoute 資源。

每個 MeshGateway 資源都有 RouteView 資源的綜合子項集合。每個 RouteView 都會對應至單一 RouteRouteView 物件會與 Route 物件一併建立。

在下圖中,Gateway A 的 RouteView 包含專案 A 的 TCPRoute 資源。Gateway B 的 RouteView 包含專案 B 的 HTTPRoute 資源和專案 C 的 GRPCRoute 資源。

`Route`、`Routeview` 和 `Gateway` 資源之間的關係。
`Route`、`Routeview` 和 `Gateway` 資源之間的關係。(按一下可放大)

這項功能的範圍為 MeshGateway 層級。GatewayMeshRouteView 會列出附加至該 GatewayMesh 的路徑,而非附加至相關聯範圍的所有路徑。

如要列出 RouteView 資源,請發出以下指令:

gcloud alpha network-services route-views list \
    --location=global \
    --[mesh | gateway]=[ MESH_NAME | GATEWAY_NAME ]

如要取得路線本身的更多資訊,請發出下列指令:

gcloud alpha network-services route-views describe --route-view=ROUTEVIEW_FULLNAME

常見的工作流程是列出 Mesh 或 Gateway 的 RouteViews,然後說明每個項目,以便全面瞭解已連結的路徑。

您無法建立、更新或刪除 RouteView 資源。當對應的 Route 資源建立、更新或刪除時,這些資源也會一併建立、更新或刪除。

疑難排解

如果路徑檢視指令無法列出 Listed 0 items. 等路徑的 RouteView,或是未列出所有已知路徑:

  • 請確認在 route-views list 中使用的 Mesh 或 Gateway 分別使用以下方式,在路徑的 meshesgateways 欄位中參照:
    • gcloud network-services [http-routes|grpc-routes|tcp-routes|tls-routes] describe \
          --location global ROUTE_ID
  • 如果客戶擁有許多資源,請建立支援單以取得協助。
  • 手動觸發路線更新
    • 重新匯入路線
      1. gcloud network-services http-routes export my-route --location=global \
              --destination=export.yaml
      2. gcloud network-services http-routes import my-route --location=global \
              --source=export.yaml
    • 如果客戶使用產生的 NetworkServices 用戶端,請呼叫適當的 NetworkServices.Update*Route API。
    • 修改說明,觸發 Terraform 自動化。

後續步驟