Custom Health check with GCP

4/8/2019

Hi I try to use custom health check with GCP LoadBalancer.

I have added readinessProbe & livenessProbe like this:

    readinessProbe:
      httpGet:
        path: /health
        port: dash
      initialDelaySeconds: 5
      periodSeconds: 1
      timeoutSeconds: 1
      successThreshold: 1
      failureThreshold: 10
    livenessProbe:
      httpGet:
        path: /health
        port: dash
      initialDelaySeconds: 5
      periodSeconds: 1
      timeoutSeconds: 1
      successThreshold: 1
      failureThreshold: 10

But when I create my ingress I haven't got my custom health check

Path LB

-- M.Hol
google-cloud-platform
google-health
kubernetes

2 Answers

4/9/2019

I FINALIZED an answer. What I was trying to do was impossible. My GCE Ingress used a backend on port 80 . But in my ReadinessProbe I told him to check on port 8080 and on the /health path. This is impossible!

The port of the service declared in the Ingress backend must be the same as that declared in the readinessProbe. Only the path can be different. If we do not respect this pattern, it is / that is associated with the Health Check GCP path.

From a network point of view this is logical, the Health Check GCP is "out" of the Kube cluster, if we tell it to route on port 80 but our ReadinessProbe is on another port, how it can ensure that even if the port associated with the ReadinessProbe meets port 80 (which is the one on which it must route traffic) also respond.

In summary, the port of the backend declared in Ingress must have a readinessProbe on the same port. The only thing we can customize is the path.

-- M.Hol
Source: StackOverflow

4/8/2019

I think you are confused between resources in GCP.

The code you posted is at no moment in relation to a Load balancer resource, as it's a kubernetes health check for pod states. If you want to know if the probes are working, check your pod state, if it's not running describe your pod and look at the logs, should indicate an issue with the probes.

I'm going to guess that you have an ingress resource somewhere in your kubernetes conf wich creates the lb and all the resources around it like the health check (still guessing that the image you posted is in relation to that).

If you are using GKE you should leave the google automated resource conf from k8s config you deployed as it is, cause you may brake some things that google is already maintaining for you.

-- night-gold
Source: StackOverflow