Health Checking & Readiness Probes
Use the standard gRPC health checking protocol so load balancers and orchestrators know when a service is ready to serve traffic.
Health Checking & Readiness Probes is a free gRPC & High Performance APIs lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the gRPC & High Performance APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Health Checks Matter
An orchestrator must know whether a service instance can handle requests. Sending traffic to a starting, overloaded, or broken instance causes errors.
The gRPC health checking protocol answers: is this service healthy?
The Standard Health Service
gRPC defines grpc.health.v1.Health with two methods:
Check— a one-shot status queryWatch— a stream of status updates
Status is SERVING, NOT_SERVING, or UNKNOWN.
Per-Service Status
A health request names a service. An empty name asks about the whole server; a specific name asks about one service, so you can report each independently.
Registering the Health Server (Go)
The health package provides a ready implementation you register on your server.
import 'google.golang.org/grpc/health'
import hpb 'google.golang.org/grpc/health/grpc_health_v1'
hs := health.NewServer()
hpb.RegisterHealthServer(s, hs)Setting Status
Update status as your service transitions. Mark NOT_SERVING during startup or shutdown, then SERVING when ready.
hs.SetServingStatus('', hpb.HealthCheckResponse_SERVING)
hs.SetServingStatus('my.pkg.Orders', hpb.HealthCheckResponse_SERVING)Readiness vs Liveness
Two distinct ideas:
- Liveness: is the process alive? Restart if not.
- Readiness: can it serve now? Remove from rotation if not, but do not restart.
Health status maps cleanly to readiness.
Kubernetes gRPC Probes
Kubernetes supports native gRPC probes. Point them at your health service.
readinessProbe:
grpc:
port: 9090
service: my.pkg.OrdersProbing with grpc_health_probe
The grpc_health_probe binary lets you check health from a shell or older Kubernetes versions.
grpc_health_probe -addr=localhost:9090 -service=my.pkg.OrdersWatch for Live Updates
Smart load balancers use Watch to receive a stream of status changes, reacting instantly when an instance flips to NOT_SERVING instead of polling.
Graceful Shutdown
Before stopping, set status to NOT_SERVING and wait. Load balancers drain you out, in-flight requests finish, and clients avoid hitting a dying instance.
Tying Health to Dependencies
Report NOT_SERVING when a critical dependency (database, cache) is unreachable, so traffic routes only to instances that can actually do work.
Quick Check
Test your health-check knowledge.
Recap
You learned gRPC health checking:
- The standard
Healthservice offersCheckandWatch - Status is per-service:
SERVING,NOT_SERVING,UNKNOWN - Map health to readiness; pair with liveness probes
- Kubernetes and
grpc_health_probeconsume it - Flip to
NOT_SERVINGfor graceful drain and failed dependencies
Frequently asked questions
Is the “Health Checking & Readiness Probes” lesson free?
Yes — the full text of “Health Checking & Readiness Probes” is free to read here on the web, and the gRPC & High Performance APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the gRPC & High Performance APIs course, upgrade to CoddyKit PRO.
What will I learn in “Health Checking & Readiness Probes”?
Use the standard gRPC health checking protocol so load balancers and orchestrators know when a service is ready to serve traffic. You practise gRPC & High Performance APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start gRPC & High Performance APIs?
No prior experience is required. gRPC & High Performance APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Health Checking & Readiness Probes” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this gRPC & High Performance APIs lesson?
Yes. Every gRPC & High Performance APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Logging gRPC Interactions
- Tracing with OpenTelemetry
- Monitoring gRPC Metrics
- Health Checking & Readiness Probes