简体   繁体   English

kubectl 命令查找特定 pod 状态为就绪

[英]kubectl command to find a particular pod status as ready

I wanted to hit a command which searches pod with the service name and identify its pod's status as "Ready"我想执行一个命令,该命令使用服务名称搜索 pod 并将其 pod 的状态标识为“就绪”

I tried some of the commands but it does not work and it does not search with service-name.我尝试了一些命令,但它不起作用并且不使用服务名称进行搜索。

kubectl get svc | grep my-service | --output="jsonpath={.status.containerStatuses[*].ready}" | cut -d' ' -f2

I tried to use the loop also, but the script does not give the desired output.我也尝试使用循环,但脚本没有提供所需的输出。

Can you please help me figure out the exact command?你能帮我弄清楚确切的命令吗?

I wanted to hit a command which searches pod with the service name and identify its pod's status as "Ready"我想点击一个命令,用服务名称搜索 pod 并将其 pod 的状态标识为“就绪”

I tried some of the commands but it does not work and it does not search with service-name.我尝试了一些命令,但它不起作用并且它不使用服务名称进行搜索。

kubectl get svc | grep my-service | --output="jsonpath={.status.containerStatuses[*].ready}" | cut -d' ' -f2

I tried to use the loop also, but the script does not give the desired output.我也尝试使用循环,但脚本没有给出所需的 output。

Can you please help me figure out the exact command?你能帮我弄清楚确切的命令吗?

I wanted to hit a command which searches pod with the service name and identify its pod's status as "Ready"我想点击一个命令,用服务名称搜索 pod 并将其 pod 的状态标识为“就绪”

I tried some of the commands but it does not work and it does not search with service-name.我尝试了一些命令,但它不起作用并且它不使用服务名称进行搜索。

kubectl get svc | grep my-service | --output="jsonpath={.status.containerStatuses[*].ready}" | cut -d' ' -f2

I tried to use the loop also, but the script does not give the desired output.我也尝试使用循环,但脚本没有给出所需的 output。

Can you please help me figure out the exact command?你能帮我弄清楚确切的命令吗?

Very easy and native command:非常简单的本机命令:

kubectl get pods --field-selector status.phase=Running

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM