<p>We have an HTTP <code>livenessProbe</code> setup which returns a 500 if service is unhealthy, and prints out what the problem is.<br />
Is there any way to view the output that was returned by <code>livenessProbe</code>?</p>
<p>I could log it in the application, but maybe it's possible to view from Kubernetes?</p>
<p>Currently, the only thing that I see doing <code>pod describe</code>:</p>
<pre><code>Killing container with id docker://12568746c312e6646fd6ecdb2123db448be0bc6808629b1a63ced8b7298be444:pod &quot;test-3893895584-7f4cr_test(524091bd-49d8-11e7-bd00-42010a840224)&quot; container &quot;test&quot; is unhealthy, it will be killed and re-created.
</code></pre>
<p>Running on GKE</p>

<p>Unfortunately, there does not seem to be a way to access the HTTP response body of a failed HTTP probe.</p>

<p>To confirm this suspicion, let's have a look at the <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/probe/http/http.go#L65" rel="noreferrer">HTTP Prober's source code</a>, which is run within the Kubelet daemon:</p>

<pre><code>func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (probe.Result, string, error) {
    // ...
    body := string(b)
    if res.StatusCode &gt;= http.StatusOK &amp;&amp; res.StatusCode &lt; http.StatusBadRequest {
        glog.V(4).Infof("Probe succeeded for %s, Response: %v", url.String(), *res)
        return probe.Success, body, nil
    }
    glog.V(4).Infof("Probe failed for %s with request headers %v, response body: %v", url.String(), headers, body)
    return probe.Failure, fmt.Sprintf("HTTP probe failed with statuscode: %d", res.StatusCode), nil
}
</code></pre>

<p>As you can see, the Kubelet daemon will log the HTTP response body of a failed probe in its own log, but even then only if verbosity was set to 4 or higher. Beyond logging the response in its own log, it is not passed back from the <code>DoHTTPProbe</code> method and will not be processed any further by the Kubelet.</p>

<p>As already noted by yourself, I'd think your safest bet would be to log the data you need from within your application itself.</p>
