Kubernetes liveness/readiness problem and json return

1/22/2019

What is the best way to handle the results returned (in this case, json) from a liveness/readiness probe to indicate success or failure?

returned json: {"status":"ok","data":[],"count":0}

thanks.

-- sebastian
kubernetes

1 Answer

1/22/2019

It is better if http status code can be used to indicate health (can be used in addition to response body). Then you can use an http probe. I've not seen the body used in an http probe so to do that and can't see anything in the API for the httpget action for parsing the response body ( https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#httpgetaction-v1-core). So you probably have to use an exec/command probe instead and perform a curl.

So https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-a-liveness-command rather than https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-a-liveness-http-request

-- Ryan Dawson
Source: StackOverflow