<p>I am trying to deploy a pod to the cluster. The application I am deploying is not a web server. I have an issue with setting up the liveness and readiness probes. Usually, I would use something like /isActive and /buildInfo endpoint for that.</p>
<p>I've read this <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command</a>.</p>
<p>Wondering if I need to code a mechanism which will create a file and then somehow prob it from the deployment.yaml file?</p>
<p>Edit: this is what I used to keep the container running, not sure if that is the best way to do it?</p>
<p><code>- touch /tmp/healthy; while true; do sleep 30; done;</code></p>

webahead
<p>It does not make sense to create files in your application just for the liveness probe. On the K8s documentation this is just an example to show you how the exec command probe works.</p>
<p>The idea behind the liveness probe is bipartite:</p>
<ol>
<li>Avoid traffic on your Pods, before they have been fully started.</li>
<li>Detect unresponsive applications due to lack of resources or deadlocks where the application main process is still running.</li>
</ol>
<p>Given that your deployments don't seem to expect external traffic, you don't require a liveness probe for the first case. Regarding the second case, question is how your application could lock up and how you would notice externally, e.g. by monitoring a log file or similar.</p>
<p>Bear in mind, that K8s will still monitor whether your applications main process is running. So, restarts on application failure will still occur, if you application stops running without a liveness probe. So, if you can be fairly sure that your application is not prone to becoming unresponsive while still running, you can also do without a liveness probe.</p>
