Home > Net >  Kubernetes: list a node's all pods and pod statuses
Kubernetes: list a node's all pods and pod statuses

Time:10-14

I want to list a node's pods and pod statues, eg.

Node A
Pod1 Status
Pod2 Status

Node B
Pod1 Status
Pod2 Status

Is there a kubectl command I can use for this?

CodePudding user response:

Try this:
kubectl get pods -A --field-selector spec.nodeName=<node name> | awk '{print $2" "$4}'

CodePudding user response:

Other commands on this link.

kubectl get pods -o wide

CodePudding user response:

kubectl get pods

will give you almost what you want, but it has no Node information, that is why you would need -o wide (I doubt you really want the -A parameter here); then you need a bit of awk. So may be like this:

kubectl get pods -o wide  | awk '{print $1"  "$3"  "$7}
  • Related