kubernetes health check job into google cloud platform

5/13/2018

I'm using kubernets 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 responce 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 realy do not know what happend 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?

-- EmyNikhil
google-kubernetes-engine
kubernetes
kubernetes-health-check

1 Answer

5/13/2018

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.

-- Hamed
Source: StackOverflow