Open GRPC Server via Ingress in Google Cloud

I am trying to expose a GRPC Java service, considering the Ingress to be the outside world from my GKE cluster.

The problem is that the default GKE implementation creates a health check that expects 200 responses to curl "/". Expected and documented here .

Unfortunately this doesn't seem to work with grpc-java as it doesn't handle "/" GET requests.

GRPC itself defines a health check protocol . But it is also not supported.

I wonder if there is a similar secret annotation like "kubernetes.io/ingress.global-static-ip-name", but to disable health checks at least (ideally overriding them).

+3


source to share


2 answers


GCP HTTP Load Balancers do not seem to support HTTP / 2 at the moment . So I ended up just exposing my service via LoadBalancer instead of NodePort + Ingress.



Note: the static IP address provided in loadBalancerIP

must be REGIONAL . For a multi-hop static IP, my external front-end service was always pending.

+1


source


The health check can be modified by defining custom health / readiness probes . This way you can define custom endpoints for health checks. Here's an example from the documentation:

 livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
    httpHeaders:
    - name: X-Custom-Header
      value: Awesome
  initialDelaySeconds: 3
  periodSeconds: 3

      



If you need something more powerful than a simple HTTP check, you can build a probe with "exec" instead of "httpGet". With exec, you can use Linux commands or a custom CLI script in your container to query your API or otherwise check the state of your system. If the / script command returns 0, then the camera is considered healthy. This sample will treat the pod as live if the file exists in / tmp / health:

livenessProbe:
  exec:
    command:
    - cat
    - /tmp/healthy
  initialDelaySeconds: 5
  periodSeconds: 5

      

+1


source







All Articles