yes, you can use the grep
command to search for Success
string, if it is found it would return 0
(passing the probe) , however if Success
string is not found by grep
it would return non-zero
rc(failing the probe)
livenessProbe:
exec:
command:
- grep
- Success
- /tmp/healthy
As per documentation
If the command succeeds, it returns 0, and the kubelet considers the
container to be alive and healthy. If the command returns a non-zero
value, the kubelet kills the container and restarts it.
This means, exec
type depends on the return code of the command. as long as grep
is returning success , probe will pass. In shell return code of any command can be manually checked via $?
variable. Eg: :
grep Success /tmp/healthy; echo $?