我正在尝试使用这个启动探针
startupProbe:
exec:
command:
- >-
test $(java -cp /the/path/to/the/app.jar app.Controller port=4990 cmd="v" | grep -E 'r5|v5' | wc -l) -eq 2 && echo $? || echo $?
initialDelaySeconds: 5 #How many seconds to wait after the container has started
timeoutSeconds: 1 #Timeout of the probe
successThreshold: 1 #Threshold needed to mark the container healthy
periodSeconds : 10 #Wait time between probe executions
failureThreshold: 110 #Threshold needed to mark the container unhealthy.这是一个java应用程序,需要很长时间(大约15分钟)来加载一些组件。这是一个遗留的应用程序,我对此无能为力。
我正在修改响应,尝试得到两行结果,然后返回0或1作为退出代码,由探针决定。
但我明白他的错误
Startup probe errored: rpc error: code = Unknown desc = failed to exec in container: failed to start exec "8ad860ffc7a87e95fb65e37dc14945c04fa205f9a524c7f7f08f9d6ef7d75": OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "test $(java -cp /the/path/to/the/app.jar app.Controller port=4990 cmd=\"v\" | grep -E 'r5|v5' | wc -l) -eq 2 && echo $? || echo $?": stat test $(java -cp /the/path/to/the/app.jar app.Controller port=4990 cmd="v" | grep -E 'r5|v5' | wc -l) -eq 2 && echo $? || echo $?: no such file or directory: unknown如果我不使用&& echo $? || echo $?部件,探针会引发错误,即退出代码是2而不是1。
怎么回事??
发布于 2022-02-24 03:13:13
您需要启动一个shell来运行脚本:
startupProbe:
exec:
command:
- sh
- -c
- >-
...https://stackoverflow.com/questions/71241490
复制相似问题