This is an extension to the question here - how can I get the list pods running on nodes with a certain label?
I am trying to find the pods in a specific zone (failure-domain.beta.kubernetes.io/zone)
You can get all nodes' name with the label you want using for
command and list the pods within theses nodes:
Example:
for node in $(kubectl get nodes -l failure-domain.beta.kubernetes.io/zone=us-central1-c -ojsonpath='{.items[*].metadata.name}'); do kubectl get pods -A -owide --field-selector spec.nodeName=$node; done
The command will list all pods with label failure-domain.beta.kubernetes.io/zone=us-central1-c
and then list the pods.