<p>What would be the best way to create a liveness probe based on incoming TCP traffic on particular port?</p>
<p><code>tcpdump</code> and <code>bash</code> are available inside so it could be achieved by some script checking if there is incoming traffic on that port, but I wonder if there are better (cleaner) ways?</p>
<p>The example desired behaviour:</p>
<p>if there is no incoming traffic on port <code>1234</code> for the last <code>10 seconds</code> the container crashes</p>

Wiktor Kisielewski
<p>if there is no incoming traffic on port 1234 for the last 10 seconds the container will be restarted with the below configuration. Also, note that there is no probe that makes the container crashes</p>
<pre><code>livenessProbe:
  tcpSocket:
    port: 1234 
  periodSeconds: 10 
  failureThreshold: 1
</code></pre>
<p>Here is the <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-tcp-liveness-probe" rel="nofollow noreferrer">documentation</a></p>
