I am adding liveness probe and readiness probe using Exec probe.
My config looks like this:
readinessProbe:
exec:
command: "/usr/bin/jps -l | grep QueueProcess"
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
When the above one didn't work. I modified this and also tried:
readinessProbe:
exec:
command: ["/usr/bin/jps", "-l", "|", "grep","QueueProcess"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
On running kubectl describe pod
, got following output:
Normal Created 37s kubelet Created container app1
Normal Started 37s kubelet Started container app1
Warning Unhealthy 6s (x3 over 26s) kubelet Readiness probe failed: invalid argument count
usage: jps [-help]
jps [-q] [-mlvV] [<hostid>]
Definitions:
<hostid>: <hostname>[:<port>]
I tried another application, where I am running grpcurl
to call health check:
readinessProbe:
exec:
command: ["grpcurl", "-plaintext", "-protoset", "/app/HealthCheck.protoset", "localhost:8123", "service.HealthCheckService/GetHealthCheck","|", "jq", ".", "|","grep","200"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
On running kubectl describe pod
for this one, I got:
Normal Created 23s kubelet Created container app2
Normal Started 23s kubelet Started container app2
Warning Unhealthy 3s (x2 over 13s) kubelet Readiness probe failed: Too many arguments.
Try 'grpcurl -help' for more details.
Both of these are failing.
The question, how can I write an Exec probe
, which has a pipe(or multiple pipe) in it?
I am using EKS v1.18.
(Both the above configs belong to different applications.)
You need to actually use a shell, since that's a shell feature. sh -c "foo | bar"
or whatever. Also remember that all the relevant commands need to be available in the target image.
So your YAML should look like this:
readinessProbe:
exec:
command: ["sh", "-c", "/usr/bin/jps -l | grep QueueProcess"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2