Setting up Kubernetes probes for workloads providing gRPC services.

The working example described in this article is available for download.

You have a workload running on Kubernetes that provides gRPC services and are looking to add both a liveness and readiness probe to it. First, we need to remind ourselves what they are and more importantly what they are used for.

Many applications running for long periods of time eventually transition to broken states, and cannot recover except by being restarted. Kubernetes provides liveness probes to detect and remedy such situations.

Kubernetes — Configure Liveness, Readiness and Startup Probes

Sometimes, applications are temporarily unable to serve traffic. For example, an application might need to load large data or configuration files during startup, or depend on external services after startup. In such cases, you don’t want to kill the application, but you don’t want to send it requests either. Kubernetes provides readiness probes to detect and mitigate these situations. A pod with containers reporting that they are not ready does not receive traffic through Kubernetes Services.

Kubernetes — Configure Liveness, Readiness and Startup Probes

Thinking about this, a simple liveness check would be to validate that the workload can respond to any gRPC service method call. A readiness check, presumably exposed as a gRPC service method, would be need to crafted more specifically to reflect the availability of the workload’s external dependencies.

#kubernetes #grpc

Kubernetes, gRPC Services, and Probes by Example
1.65 GEEK