Cloud Service Mesh Gateway API 现在提供透明健康检查(即与 Kubernetes 就绪状态数据集成的通用健康检查),以便将流量发送到标记为就绪的 Pod。此功能适用于 HTTP 和 gRPC 服务。
Cloud Service Mesh 会将您的 Kubernetes Pod 的状态直接公开给 Google 健康检查基础设施,因此您用于 Pod readinessProbes 的相同配置会透明地传递给 Google 负载均衡健康检查基础设施,并且健康检查状态会与就绪探测状态保持一致。为此,系统会使用一个名为“Transparent Health Checker”的组件,该组件会在将提供 Pod 健康状态的每个节点上运行。
Cloud Service Mesh 会将从健康检查基础设施来源范围发送的健康检查流量配置为发送到预留端口 (7877)。此流量会重定向到节点本地的透明健康检查服务器。服务器会响应一个与 Kubernetes Pod 就绪性的当前状态匹配的健康状态。流向 Kubernetes Pod 的流量会根据在每个 Pod 上设置的“就绪”状态进行控制。您可以选择使用就绪性探测和就绪性门控值来控制“就绪”状态。透明健康检查将根据所有 Kubernetes 条件的逻辑运算符 AND 报告状态。
您可以配置会影响 Kubernetes Pod 就绪性状态的 Kubernetes 探测、就绪性门控和其他检查。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],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/v1.24/docs/gateway/prepare-gateway#create_and_register_a_cluster).\n- [Installed the custom resource definitions](/service-mesh/v1.24/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/v1.24/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/v1.24/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"]]