列出 `Route` 資源

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

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

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

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

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

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

這項功能適用於 MeshGateway 層級。RouteView,適用於附加至該 GatewayMeshGatewayMesh 清單路徑,而非附加至相關聯範圍的所有路徑。

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

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

如要進一步瞭解 Route 本身,請發出下列指令:

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

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

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

疑難排解

如果 route-views 指令無法列出路徑的 RouteViews (例如 Listed 0 items.),或無法列出所有已知路徑:

  • 確認 route-views list 中使用的網格或閘道分別在路徑的 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 自動化作業。

後續步驟