Kubernetes:如何使用带有管道的Exec编写livenessprobe和ReadinesProbe

Kubernetes:如何使用带有管道的Exec编写livenessprobe和ReadinesProbe,kubernetes,pipe,exec,readinessprobe,Kubernetes,Pipe,Exec,Readinessprobe,我正在使用Exec probe添加活动探测和准备探测。 我的配置如下所示: readinessProbe: exec: command: "/usr/bin/jps -l | grep QueueProcess" periodSeconds: 10 failureThreshold: 2 successThreshold: 2 当上面的一个不起作用时。我对此进行了修改,并尝试: readinessProbe: exec

我正在使用Exec probe添加活动探测和准备探测。
我的配置如下所示:

readinessProbe:
    exec:
      command: "/usr/bin/jps -l | grep QueueProcess"
    periodSeconds: 10 
    failureThreshold: 2
    successThreshold: 2
当上面的一个不起作用时。我对此进行了修改,并尝试:

readinessProbe:
     exec:
       command: ["/usr/bin/jps", "-l", "|", "grep","QueueProcess"]
     periodSeconds: 10 
     failureThreshold: 2
     successThreshold: 2
运行
kubectl descripe 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>]

在运行
kubectl descripe 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.

这两项都失败了。 问题是,如何编写一个
Exec探测器
,其中包含一个管道(或多个管道)

我正在使用EKS v1.18。

(以上两种配置都属于不同的应用程序。)

您需要实际使用shell,因为这是shell功能<代码>sh-c“foo | bar”或其他什么。还请记住,所有相关命令都需要在目标图像中可用。

您需要实际使用shell,因为这是shell功能<代码>sh-c“foo | bar”或其他什么。还请记住,所有相关命令都需要在目标图像中可用。

添加了更多信息,请看一看。数组形式是正确的,但是,如果需要shell功能,您需要使用shell。命令按字面意思运行<代码>命令:[sh,-c,“/usr/bin/jps-l | grep QueueProcess”]是的,这很有效。谢谢如果您添加了更多信息,可以看一看。数组形式是正确的,但是,如果您想要shell功能,您需要使用shell。命令按字面意思运行<代码>命令:[sh,-c,“/usr/bin/jps-l | grep QueueProcess”]是的,这很有效。谢谢
  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.