Cloud Service Mesh Gateway API 現在提供透明健康檢查,也就是與 Kubernetes 就緒狀態資料整合的通用健康檢查,可將流量導向標示為就緒的 Pod。這項功能適用於 HTTP 和 gRPC 服務。
Cloud Service Mesh 會直接將 Kubernetes Pod 的狀態公開給 Google 健康狀態檢查基礎架構,因此您用於 Pod 就緒探針的相同設定會直接傳遞給 Google 負載平衡健康狀態檢查基礎架構,而健康狀態檢查狀態也會與就緒探針狀態保持一致。這項作業會使用名為「透明健康檢查器」的元件,該元件會在每個提供 Pod 健康狀態的節點上執行。
Cloud Service Mesh 會將從健康檢查基礎架構來源範圍傳送的健康檢查流量,設為傳送至預留的通訊埠 (7877)。這類流量會重新導向至節點中本機的透明健康狀態檢查伺服器。伺服器會傳回與 Kubernetes Pod 完備性目前狀態相符的健康狀態。系統會根據每個 Pod 的「就緒」狀態,控制流向 Kubernetes Pod 的流量。您可以選擇使用就緒探針和就緒門檻值控制「就緒」狀態。透明健康檢查會根據所有 Kubernetes 條件的邏輯運算子 AND 回報狀態。
您可以設定 Kubernetes 探測功能、完備性門檻和其他影響 Kubernetes Pod 完備性狀態的檢查項目。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-19 (世界標準時間)。"],[],[],null,["# Configure Kubernetes readiness probes (Optional)\n================================================\n\nThis page describes how to use Cloud Service Mesh with Google Cloud health check infrastructure to configure Kubernetes probes and readiness gates.\n\nPrerequisites\n-------------\n\nAs a starting point, this guide assumes that you have already:\n\n- [Created a GKE cluster and registered it to a fleet](/service-mesh/docs/gateway/prepare-gateway#create_and_register_a_cluster).\n- [Installed the custom resource definitions](/service-mesh/docs/gateway/prepare-gateway#install_custom_resource_definitions).\n\nTransparent Healthchecks with CSM\n---------------------------------\n\nCloud Service Mesh Gateway API now offers Transparent health checks, that is, Universal HealthChecks integrated with Kubernetes readiness status data to enable traffic flow to the Pods that are marked ready. This capability is available for both HTTP and gRPC services.\n\nCloud Service Mesh exposes the status of your Kubernetes Pods directly to the Google health check infrastructure, so the same configuration you use for Pod readinessProbes will be passed transparently to the Google load balancing health check infrastructure and the health check state will be aligned with the readiness probe state. This is done using a component, called Transparent Health Checker, which runs on every node that will serve the Pod's health status.\n\nCloud Service Mesh configures Health check traffic sent from the health check infrastructure source ranges to be sent to a reserved port (7877). This traffic is redirected to the transparent health check server locally on the node. The server responds with a health status matching the current state of the Kubernetes Pod readiness. The traffic flow to Kubernetes Pods is controlled based on Ready status set on each Pod. You can optionally control the \"Ready\" status with readiness probe and readiness gates values. The transparent health-check will report the status based on a logical operator AND of all Kubernetes conditions.\n\nYou can configure Kubernetes probes, readiness gates and other checks that influence the Kubernetes Pod readiness status.\n\nConfigure readiness probes for a HTTP service (Optional)\n--------------------------------------------------------\n\nYou can optionally add this section to the Deployment for the whereami service [HTTP Service Setup](/service-mesh/docs/gateway/set-up-envoy-mesh#set_up_the_service). \n\n ...\n spec:\n containers:\n - name: whereami\n image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1\n ports:\n - containerPort: 8080\n readinessProbe:\n initialDelaySeconds: 1\n periodSeconds: 2\n timeoutSeconds: 1\n successThreshold: 1\n failureThreshold: 1\n httpGet:\n host:\n scheme: HTTP\n path: /\n port: 8080\n initialDelaySeconds: 5\n periodSeconds: 5\n\nConfigure readiness probes for a gRPC service (Optional)\n--------------------------------------------------------\n\nYou can optionally add this section to the Deployment for psm-grpc-server [gRPC service setup](/service-mesh/docs/gateway/proxyless-grpc-mesh#set_up_the_service). \n\n ...\n spec:\n containers:\n - name: psm-grpc-server\n image: ${IMAGE_NAME}\n imagePullPolicy: Always\n args:\n ${ARGS}\n ports:\n - containerPort: 50051\n readinessProbe:\n initialDelaySeconds: 1\n periodSeconds: 2\n timeoutSeconds: 1\n successThreshold: 1\n failureThreshold: 1\n grpc:\n port: 50051"]]