Search code examples
kubernetesgoogle-kubernetes-enginekubernetes-health-check

kubernetes health check job into google cloud platform


I'm using Kubernetes into google cloud platform and have defined some clusters with deployment controllers there.

For each pod into deployment there is a health check which each 30sec check my route(www.example.com) and the response must be 200 else it cause the health check goes fail.

So i decided to trace it and write die() in my index.php then health check show green status and it works correctly. I got confused and i really do not know what happened for this pod and why it does not work.

Could anybody help my to find this issue in my pod and tell me what is exactly this health check doing in GCP?


Solution

  • health check used to verify if a container in a pod is healthy and ready to serve traffic.

    So you should check your http status code at first:

    curl -I www.example.com

    What is your http status code in the response?

    when you write die() in your index.php then i am sure http status code is 200

    but when you remove it from your index.php then http code is something else!

    you may redirect user after visitign www.example.com then in this case http status code is not 200.

    make sure and check http status code of health check url is 200 , if it is not 200 then you could change health check url in GKE to something else which http status code could be 200.