<p>If I know for a fact during startup that my service will not work.. Is there anything I can return from one of the probes that will tell Kubernetes to act as if the pod is no longer usable and needs to be restarted?</p>

<p>Right now as far as I understand the only responses are 200-399 which will be handled as "success" and anything else which is regarded as a failure. Are there any other options?</p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</a></p>

Shahar Prish
<p>No, there are no other ways to detect that except 3 which are described in a document you linked:</p>

<ol>
<li>HTTP check which detects response code.</li>
<li>TCP probe which check is the port open or not.</li>
<li>Exec which runs script inside your container and check its exit code.</li>
</ol>

<p>Probably in your case you can use <code>exec</code> check and something like a flag file. </p>

<p>For example, your app can create a file "/tmp/iamdead", and you can create a liveness probe like:</p>

<pre><code>livenessProbe:
  exec:
    command:
    - sh
    - -c
    - "cat /tmp/iamdead; if [ $? -eq 0 ]; then exit 1; fi"
</code></pre>
