How to implement content-based health check for GKE ingress

82 Views Asked by At

I want to implement a content-based health check for my GKE ingress. These kinds of health checks are usually specified in the BackendConfig CRD. My current BackendConfig looks like this:

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  name: XXX-hc-config
spec:
  healthCheck:
    checkIntervalSec: 15
    timeoutSec: 5
    port: 8080
    type: HTTP
    requestPath: /healthz

As seen in the link above, Google DOES support content-based health checks. But I cannot see, how to configure this. I expected something like:

healthCheck:
    checkIntervalSec: 15
    timeoutSec: 5
    port: 8080
    type: HTTP
    requestPath: /healthz
    response: "OK" <--- THIS IS NEW

but I cannot find anything about it. Not even in the CRD source code. Did anyone ever do this successfully? How?

In the GCP console you can set it like this: enter image description here

1

There are 1 best solutions below

1
Yvan G. On

Aside from the console, you can try this documentation on how to create a health check with a response string for HTTP, HTTPS, and HTTP/2 health checks.

gcloud compute health-checks create HTTP\_PROTOCOL hc-http-port-80 

COMMON\_FLAGS 

PORT\_SPECIFICATION 

--host=HOST 

--proxy-header=PROXY\_HEADER 

--request-path=REQUEST\_PATH 

--response=RESPONSE

For SSL and TCP health checks you can use this guidance.

gcloud compute health-checks create tcp hc-tcp-3268 

COMMON\_FLAGS 

PORT\_SPECIFICATION 

--proxy-header=PROXY\_HEADER 

--request=REQUEST\_STRING 

--response=RESPONSE\_STRING

Upon checking the custom health check configuration it seems that there is no option in yaml to place a response string.