Kubernetes readinessProbe livenessProbe using script

Hi ,
I am trying to execute readiness/liveness probe using bash script as below but not able to redirect script output to container logs or standard out. Is it not possible to to route logs from script to container logs ? Any suggestion

livenessProbe:
  exec:
    command:
    - /bin/sh
    - /home/test/check.sh

The stdout/stderr of probes is not really captured. You could write it to a file?

It seems like a plausible feature request, but we’re swimming in those right now and I would not want to make anyone think it is the sort of thing that can just be slapped together.

I’ve tried with an std output to file and the files never gets updated:
echo "PROBE ok" >> /fails.txt

If you put that in the script it should run. If you put that in the tank it won’t. The yaml is an exec() not a full shell.

this is my script
#/bin/bash count=tail /console.txt | grep “mysstring” | wc -lif [[ count -eq 1 ]] then echo "PROBE FAILEDdate" >> /fails.txt exit 1 fi if [[ count -eq 0 ]] then echo "PROBE ok date" >> /fails.txt exit 0 fi
and my yaml
livenessProbe: initialDelaySeconds: 30 periodSeconds: 30 failureThreshold: 6 exec: command: ["/bin/sh","-c","/probe.sh"]
I don’t know about the tank… kind of new to Kubernetes scripts

The formatting is a bit messed up, but I assume you tested this script and it works?

Does the container user have access to write to / ?

Is it possible that the count is > 1 ?

Maybe log something at the top of this to convince yourself it is even running at all.