Home > Software design >  Kubectl get pods that have ready 1/1 and status running
Kubectl get pods that have ready 1/1 and status running

Time:05-28

Is there a way to get the pods that have status Running and also ready 1/1? This is what I tried so far:

kubectl get pod -l app=quarkus-jvm --field-selector=status.phase==Running

The command above returns also the pods that are not ready 0/1. I would like to get only one entry, the one with ready 1/1.

enter image description here

Thank you !

CodePudding user response:

I have tested this on a playground

Before:

[node2 ~]$ kubectl get pods --field-selector=status.phase==Pending 
nginx-deployment-66b6c48dd5-cctsd   0/1     Pending   0          8m29s
nginx-deployment-66b6c48dd5-hlhlp   0/1     Pending   0          8m29s

After

 kubectl get pods --field-selector=status.phase==Pending | grep "66b6c48dd5-cctsd"
nginx-deployment-66b6c48dd5-cctsd   0/1     Pending   0          8m49s

The grep command is a way to filter content. You can try with this one command:

kubectl get pod -l app=quarkus-jvm --field-selector=status.phase==Running | grep "1/1"
  • Related