k8s list all nodes on which pods can be scheduled code example
Example 1: get pods on specific node
kubectl get pods -n $namespace -o wide --field-selector spec.nodeName=$node
Example 2: kubectl get pod by node
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>