microservices-demo
microservices-demo copied to clipboard
Switch to Kubernetes builtin grpc health checks
I recommend doing this when (1) grpc builtin health checks are in a stable Kubernetes version (2) it's been 6 months since that version is released.
Kubernetes now supports builtin grpc health checks for probes, so we can stop using the grpc-health-probe tool I wrote for this project and further cut down external dependencies. It looks like this:
@@ -44,11 +44,15 @@ spec:
# - name: JAEGER_SERVICE_ADDR
# value: "jaeger-collector:14268"
readinessProbe:
- exec:
- command: ["/bin/grpc_health_probe", "-addr=:3550"]
+ grpc:
+ port: 3550
livenessProbe:
- exec:
- command: ["/bin/grpc_health_probe", "-addr=:3550"]
+ grpc:
+ port: 3550
resources:
requests:
cpu: 100m
This new implementation by upstream Kubernetes will be ideal indeed.
This feature is at the alpha state with Kubernetes 1.23, so it won't be yet adopted on stable channel with GKE or other managed offer out there. 1.22 for default in rapid as we speak.
Note: the official doc for this feature is mentioning liveness probe but is it working for readiness probe too?
Other note: for the transition, could we have 2 Dockerfile files per app in order to have both container images, with or without the grpc_health_probe binary? It will allow options for the end users adopting this feature or not while it will become more stable/by default.
Sharing the good progress of this feature in Kubernetes upstream, with the 1.24 release:
With Kubernetes 1.24, the gRPC probes functionality has entered beta and is available by default. You can now configure startup, liveness, and readiness probes for your gRPC app natively within Kubernetes without exposing an HTTP endpoint or using an extra executable.
Easy to do even with GKE 1.23 (alpha + rapid) like documented here: https://kubernetes.io/blog/2022/05/13/grpc-probes-now-in-beta/ :)
Since 0.4.1 it's now an optional Online Boutique variation (i.e. a Kustomize overlay) you could leverage. See associated blog article illustrating this: https://medium.com/google-cloud/b5bd26253a4c.
Closing the issue because the mentioned functionality is implemented as the native-grpc-health-check kustomize component.