Lesson 21 / 25

Health Checks, Reflection and Tools

Operating and exploring services.

Standard services and CLIs

The standard health checking protocol (grpc.health.v1.Health with Check and Watch) reports whether a server or a specific service is serving; Kubernetes supports native gRPC probes that use it. Server reflection lets tools discover services and message types at runtime, which is handy in development but often disabled in production. Tools: grpcurl (curl for gRPC), grpcui, Postman, BloomRPC-style GUIs, and buf curl.

Exploring a service with grpcurl and probing health

Commands and a Kubernetes probe.

# list services (requires server reflection) and call a method
grpcurl -plaintext localhost:50051 list
grpcurl -plaintext -d '{"id": "o-1001"}' localhost:50051 shop.v1.OrderService/GetOrder

# check health
grpcurl -plaintext -d '{"service": "shop.v1.OrderService"}' localhost:50051 grpc.health.v1.Health/Check

# Kubernetes container spec (native gRPC probe)
# livenessProbe:
#   grpc:
#     port: 50051

Use proto files when reflection is off

grpcurl can load .proto files with -import-path and -proto instead of relying on reflection.

Quick check: What does gRPC server reflection enable?

  • Automatic retries
  • Tools can discover services and message types at runtime
  • TLS certificate rotation
  • Database migrations
Answer

Tools can discover services and message types at runtime — Useful for grpcurl and GUIs.