<p>Is there a way to tell Kubernetes to just destroy a pod and create a new one if the liveness probe fails? What I see from logs now: my node js application is just restarted and runs in the same pod.</p>

<p>The liveness probe is defined in my YAML specification as follows:</p>

<pre><code>livenessProbe:
 httpGet:
 path: /app/check/status
 port: 3000
 httpHeaders:
 - name: Accept
   value: application/x-www-form-urlencoded
 initialDelaySeconds: 60
 periodSeconds: 60
</code></pre>

<p>Disclaimer:<br></p>

<p>I am fully aware that recreating a pod if a liveness prove fails is probably not the best idea and a right way would be to get a notification that something is going on.</p>

Nick Ponomar
<p>So liveness and readiness probes are defined in <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-a-liveness-command" rel="noreferrer">containers not pods</a> so if you have 1 container in your pod and you specify <code>restartPolicy</code> to <code>Never</code>. Then your pod will go into a <code>Failed</code> state and will be scrapped at some point based on the <code>terminated-pod-gc-threshold</code> value.</p>

<p>If you have more than one container in your pod it becomes tricker because of your other container(s) running making the pod still be in <code>Running</code> status.  You can build your own automation or try <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate" rel="noreferrer">Pod Readiness</a> which is still in alpha as of this writing.</p>
