<p>I have the following liveness probe in my service deployment.yaml</p>

<pre><code>      livenessProbe:
        failureThreshold: 3
        httpGet:
          path: /health
          port: 9081
          scheme: HTTP
        initialDelaySeconds: 180
        timeoutSeconds: 10
        periodSeconds: 10
        successThreshold: 1
</code></pre>

<p>I want to test that the probe is actually triggering a POD redeployment, which is the easiest thing to do to make it fail? 
Possibly in a programmatic way.</p>

<h2>Update:</h2>

<p>Better to clarify the question, I don't want to change the code in the application, neither pausing the container that is running.
I was wondering if it's possible to block someway the endpoint/port at runtime maybe using a kubernetes or docker command.</p>

<p>You could define your liveness probe as follows</p>

<pre><code>livenessProbe:
  exec:
    command:
      - /bin/bash
      - '-c'
      - /liveness-probe.sh
  initialDelaySeconds: 10
  periodSeconds: 60
</code></pre>

<p>And create an sh file in your root path named </p>

<blockquote>
  <p>liveness-probe.sh</p>
</blockquote>

<p>that contains</p>

<pre><code>#!/bin/bash
#exit 0 #Does not fail and does not trigger a pod restart
exit 1 #Triggers pod restart
</code></pre>
