kad*_*amb 1 pipe exec kubernetes readinessprobe
我正在使用 Exec 探针添加活性探针和就绪探针。
我的配置如下:
readinessProbe:
exec:
command: "/usr/bin/jps -l | grep QueueProcess"
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
Run Code Online (Sandbox Code Playgroud)
当上面的方法不起作用时。我对此进行了修改并尝试了:
readinessProbe:
exec:
command: ["/usr/bin/jps", "-l", "|", "grep","QueueProcess"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
Run Code Online (Sandbox Code Playgroud)
运行时kubectl describe pod
,得到以下输出:
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>]
Run Code Online (Sandbox Code Playgroud)
我尝试了另一个应用程序,我正在其中运行grpcurl
来调用运行状况检查:
readinessProbe:
exec:
command: ["grpcurl", "-plaintext", "-protoset", "/app/HealthCheck.protoset", "localhost:8123", "service.HealthCheckService/GetHealthCheck","|", "jq", ".", "|","grep","200"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
Run Code Online (Sandbox Code Playgroud)
在竞选kubectl describe pod
这个项目时,我得到了:
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.
Run Code Online (Sandbox Code Playgroud)
这两者都失败了。问题是,我如何编写一个Exec probe
其中有一个管道(或多个管道)的 ?
我正在使用 EKS v1.18。
(以上两个配置属于不同的应用程序。)
您需要实际使用 shell,因为这是 shell 功能。sh -c "foo | bar"
管他呢。另请记住,所有相关命令都需要在目标映像中可用。
所以你的 YAML 应该是这样的:
readinessProbe:
exec:
command: ["sh", "-c", "/usr/bin/jps -l | grep QueueProcess"]
periodSeconds: 10
failureThreshold: 2
successThreshold: 2
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2125 次 |
最近记录: |