關於 GKE Dataplane V2 觀測功能


GKE Dataplane V2 觀測功能提供 GKE Dataplane V2 指標和深入分析資訊,可瞭解 Google Cloud上 GKE 叢集的工作負載。從 GKE 1.28 以上版本開始,您可以使用 GKE Dataplane V2 可觀測性功能執行下列操作:

GKE Dataplane V2 可觀測性提供下列疑難排解工具:

  • Kubernetes 叢集網路拓撲
  • Kubernetes 網路政策判決表,其中包含即時流量和連線資訊
  • 指令列工具,可排解 Kubernetes 流量流動問題

GKE Dataplane V2 指標

GKE Dataplane V2 指標提供下列項目的流量資訊:

  • 流量:深入瞭解 GKE 如何處理 Pod 和服務之間的流量。
  • 強制執行網路政策:GKE 如何強制執行 Kubernetes 網路政策的相關資訊。

您可以使用 GKE Dataplane V2 指標,透過下列工具監控 Kubernetes 工作負載並排解問題:

  • Google Cloud Managed Service for Prometheus,即可查看及分析 GKE Dataplane V2 指標。您可以修改 Google Cloud Managed Service for Prometheus 設定,新增或移除要擷取至 Google Cloud Managed Service for Prometheus 的指標。
  • Cloud Monitoring Metrics Explorer,查看 Pod 層級的流量流動詳細資料。
  • Cloud Monitoring 探索及使用任何指標。舉例來說,您可以建立快訊,在 GKE Dataplane V2 指標超過特定門檻時觸發。
  • 自行管理的 Grafana,用於顯示 Google Cloud Managed Service for Prometheus 收集的指標。

啟用 Google Cloud Managed Service for Prometheus 時:

  • GKE 會建立 PodMonitoring 資源
  • GKE 會公開指標端點

如要透過 Google Cloud Managed Service for Prometheus 使用指標,並建立 PodMonitoring 資源,必須在叢集上啟用 Google Cloud Managed Service for Prometheus。如果您未啟用 Google Cloud Managed Service for Prometheus,GKE 會公開指標端點,但不會建立PodMonitoring資源。

為叢集啟用 GKE Dataplane V2 指標後,Google Cloud Managed Service for Prometheus 會擷取下列 GKE Dataplane V2 指標:

GKE Dataplane V2 指標 類型 說明
prometheus.googleapis.com/pod_flow_egress_flows_count/counter 累計 Pod 中的流程總數。
prometheus.googleapis.com/pod_flow_ingress_flows_count/counter 累計 Pod 的流程總數。

啟用 GKE Dataplane V2 指標後,系統會在每個 Kubernetes 節點上開啟指標通訊埠。

此外,您也可以使用其他指標,包括來自開放原始碼可觀測性平台 Hubble 的指標。根據預設,Google Cloud Managed Service for Prometheus 不會擷取這些額外指標,但您可以設定 Google Cloud Managed Service for Prometheus 收集這些指標。如要收集這些指標,請設定 PodMonitoring 自訂資源 (CR)

下表說明其他 Hubble 指標:

哈伯指標 類型 說明
hubble_flows_processed_total 累計 處理的流程總數。
hubble_drop_total 累計 捨棄的流量總數。
hubble_port_distribution_total 累計 依通訊埠編號彙整的處理流程總數。
hubble_tcp_flags_total 累計 已處理的流程總數,並設定指定的 TCP 旗標。
hubble_icmp_total 累計 處理的 ICMP 流量總數。

GKE Dataplane V2 觀測工具

GKE Dataplane V2 觀測功能提供代管 Hubble 解決方案,可針對透過 GKE Dataplane V2 部署的 Kubernetes 工作負載,提供網路觀測和安全性洞察資料。

啟用後,GKE Dataplane V2 觀測功能會將下列元件部署至叢集:

  • Hubble Relay:這項服務會從每個節點收集有關 Pod 的網路遙測資料。

  • Hubble CLI:指令列介面工具,可提供叢集內的即時流量資訊。

啟用叢集的 GKE Dataplane V2 可觀測性後,即可部署下列元件:

  • Hubble UI:網頁式工具,可用來查看及分析 Hubble Relay 收集的網路遙測資料。您必須啟用 GKE Dataplane V2 觀測功能,才能部署 Hubble UI。

GKE Dataplane V2 指標和可觀測性運作方式

GKE Dataplane V2 觀測功能會使用下列元件和工具,收集指標並深入瞭解網路流量:

  • GKE Dataplane V2:GKE Dataplane V2 指標和可觀測性會使用以 eBPF 為基礎的 GKE Dataplane V2 資料路徑,收集特定工作負載的 Pod 流量和網路政策強制執行情況相關指標。

  • Google Cloud Managed Service for Prometheus:GKE Dataplane V2 指標會設定 Google Cloud Managed Service for Prometheus 代理程式,將匯總指標擷取至 Google Cloud Managed Service for Prometheus。這項可擴充的監控解決方案可擷取及儲存大量資料,並讓您建構 Google Cloud Observability

  • Hubble:GKE Dataplane V2 觀測功能使用 Hubble,這是一個開放原始碼的觀測專案。Hubble 可為透過 eBPF Dataplane 部署的 Kubernetes 工作負載,提供網路觀測和安全洞察資訊。

    發生下列情況時,就會觸發 Hubble 流量事件:

    • 先建立網路連線

    • 首先會看到 TCP 標記,指出 TCP 連線的狀態

    • 自上次流程事件起,至少經過五秒後,系統才會傳輸封包

    Hubble 指標:計算 Kubernetes 叢集中的流量事件數,可用於判斷哪些 Pod 正在彼此通訊。

  • 啟用指標和觀測功能:您可以分別啟用 GKE Dataplane V2 和觀測功能。如要在開放原始碼 Hubble UI 功能中啟用網路拓撲視覺化功能,必須啟用網路檢查。

  • Autopilot 叢集:

    • 指標預設為啟用

    • 觀測工具預設為停用

    • 您必須建立 ClusterPodMonitoring 資源,才能在 Google Cloud Managed Service for Prometheus 中收集指標

  • 標準叢集:

    • 指標預設為停用

    • 觀測工具預設為停用

    • 如果已啟用 Google Cloud Managed Service for Prometheus,系統會自動建立 PodMonitoring 資源

    • PodMonitoring 資源標示為「確保存在」。如要停止將指標傳送至 Google Cloud Managed Service for Prometheus,請編輯 PodMonitoring 資源,停用所有指標

GKE Dataplane V2 觀測端點

GKE Dataplane V2 觀測元件會公開下列兩個觀測端點:

  • 指標端點:以 Prometheus 格式公開流量指標的 HTTP 端點。anetd Pod 會在每個叢集節點的通訊埠 9965 上公開指標端點。

  • 流程埠:gRPC 端點。hubble-relay Pod 會將 flows 埠端點公開為 Kubernetes ClusterIP 服務,並使用 443 埠。hubble-relay Pod 是 Kubernetes ClusterIP 服務的後端,所有對 Kubernetes ClusterIP 服務的要求都會轉送至 hubble-relay Pod。您可以使用 Hubble CLI 或 Hubble UI 存取流程埠。

限制

  • GKE Dataplane V2 觀測功能在整個叢集最多可支援 5000 個節點。
  • GKE Dataplane V2 指標和可觀測性僅適用於已啟用 GKE Dataplane V2 的叢集。Google Cloud
  • GKE Dataplane V2 指標與 Hubble 指標類似,都是以流量為基礎的指標,可提供連線資訊。這些指標不會計算傳輸的資料量或封包數。由於這些指標是以流量為準,因此無法準確呈現網路流量中傳輸的資料量。

後續步驟