HTTP health check behaviour

Hi

I’ve got a web service with a scale of 2 and I’m setting up an HTTP health check via the UI. The radio button has a label of ‘HTTP Responds 2xx/3xx’ - from this I inferred that if the health endpoint responds with anything other than 2xx or 3xx then the health check should fail? This doesn’t appear to be so as I’ve set the health endpoint up to respond with a 404 and a 500 and the health check seems to pass, i.e., the container remains up and status is green. I’ve also fired up the web service in one of the containers to listen on a different HTTP port to the one specified in the Health Check options, and, though there are no health checks going on in the container logs - the container is still green.

What would be the expected behaviour here? Also, the docs are great, but it would be quite handy to have a short explanation of each of the health check fields in the UI.
Thanks

1 Like

I’ve just been through [this thread 1877][1] in rancher issues and seen this quote from @ibuildthecloud

There is one caveat you have to be careful of, don’t know if this applies, but I’ll just give you a heads up. When we schedule the health check clients we never put in the same host as the container. The health check client is the component that does the port/http ping check. If we put it on the same host, we can never know the health check failed. We schedule up to 3 clients if we can (this requires at least 4 hosts).

We have 2 hosts set up so I’m guessing that this is affecting what I am seeing?
[1]: Dealing with Host failures · Issue #1877 · rancher/rancher · GitHub

FYI, we just added more docs on the explanation of the fields. Thanks to @etlweather for the PR. http://docs.rancher.com/rancher/concepts/health-checks/

I think @ibuildthecloud comment is old. We’ve fixed the fact that if the healthcheck is on the same host of the containers it’s fixed. And there should be no issues with 2 hosts.

Can you provide the healthState in the API for the containers of your service that have the healthcheck?

Can you also confirm that you are able to ping containers across hosts just to rule that out?

Thanks Denise for the updated documentation - that adds clarity to those fields. I’ve unsuccessfully tried to recreate the issue I was having but healthchecks now work as I expect them to so I take it that it was something with my set-up.
Thanks again.