2

I have read this and I understand (I think) the differences between Kubernetes livenessProbes, and the GKE LoadBalancer health checks.

My problem is this: I am exposing most of my Kube services via NodePort, which by default creates a new Backend Service in GKE, and also creates a load-balancer health check corresponding to that Backend HTTP service in GKE.

All of these automatically-created health checks assume I have a HTTP status endpoint on /, when I do not. I have a HTTP health check hosted on a different endpoint.

How do I

A) Somehow hint to GKE to create loadbalancer rules based off of rules defined in Kubernetes resources, rather than blindly creating a bunch listening on the wrong route, or

B) Get GKE to NOT automatically create an invalid health check for EVERY NodePort service.

Or is this just an inflexible Google Cloud quirk that I will have to make code changes to work around?

Benji L.
  • 61
  • 1
  • 7

2 Answers2

4

Discovered that the answer is

A. No

B. No

by reading the Kubernetes Ingress Github README.MD:

"..currently we just rely on kubernetes service/pod liveness probes and force pods to have a / endpoint that responds with 200 for GCE."

Benji L.
  • 61
  • 1
  • 7
  • 1
    It seems the link [was moved](https://github.com/kubernetes/ingress-gce) – Carlos Jan 24 '18 at 22:02
  • I think this still applies today. Although documentation shows a readiness probe should be able to point to a custom link, it didn't work for me. / and /healthz returning 200 works perfectly. It's not mentioend here: https://cloud.google.com/kubernetes-engine/docs/how-to/load-balance-ingress but should be :) – Vincent Gerris May 14 '20 at 08:49
0

Today, you can configure these using backendconfigs. A backendConfig is used to configure how an ingress talks to a service, including telling it how to do a health check.

You'll need to configure the service to use the BackendConfig:

apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/backend-config: '{"default": "my-backendconfig"}'
...

Then you can configure the healthcheck directly in the backendconfig:

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  name: my-backendconfig
spec:
  healthCheck:
    checkIntervalSec: INTERVAL
    timeoutSec: TIMEOUT
    healthyThreshold: HEALTH_THRESHOLD
    unhealthyThreshold: UNHEALTHY_THRESHOLD
    type: PROTOCOL
    requestPath: PATH
    port: PORT
Paul Biggar
  • 328
  • 3
  • 9