Wiktor Kisielewski
Wiktor Kisielewski

Reputation: 437

Kubernetes pod - liveness probe based on incoming port traffic

What would be the best way to create a liveness probe based on incoming TCP traffic on particular port?

tcpdump and bash 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?

The example desired behaviour:

if there is no incoming traffic on port 1234 for the last 10 seconds the container crashes

Upvotes: 0

Views: 147

Answers (1)

Kağan Mersin
Kağan Mersin

Reputation: 451

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

livenessProbe:
  tcpSocket:
    port: 1234 
  periodSeconds: 10 
  failureThreshold: 1

Here is the documentation

Upvotes: 2

Related Questions