How to list the pods running in a particular zone? And suppose my cluster is configured into multiple zones, how to ensure pods are distributed into every zone?
Topology key zone value is a label applied on nodes and so you can get the nodes with 'zone-value' and list pods of those nodes. Somethig like below,
kubectl get nodes -l zone:<zone value> -o json | jq '.items[].metadata.name' | xargs -I worker sh -c 'kubectl get pods -o wide | grep worker'
kubectl get nodes --show-labels|awk 'NR == 1 {next} {print $1,$6}'|awk -F "/" '{print $1,$NF}'|awk '{print $1,$NF}'|awk -F "=" '{print $1,$NF}'|awk '{print $1,"\t",$NF;}'