microservices-demo icon indicating copy to clipboard operation
microservices-demo copied to clipboard

Switch to Kubernetes builtin grpc health checks

Open ahmetb opened this issue 3 years ago • 3 comments
trafficstars

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

ahmetb avatar Dec 14 '21 21:12 ahmetb

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.

mathieu-benoit avatar Apr 20 '22 01:04 mathieu-benoit

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.

mathieu-benoit avatar May 04 '22 13:05 mathieu-benoit

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/ :)

mathieu-benoit avatar May 13 '22 01:05 mathieu-benoit

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.

mathieu-benoit avatar Nov 03 '22 14:11 mathieu-benoit

Closing the issue because the mentioned functionality is implemented as the native-grpc-health-check kustomize component.

minherz avatar Apr 24 '23 23:04 minherz