<p>I have a big cluster on Openshift Platform. I want to find all the projects or pods that are using NodeSelector. Is there a command for that? How can I make a list of all the projects with NodeSelectors?</p>
<p>I have a command for listing all the services using nodeport. But I could not do it for nodeSelector.</p>

ma9811
<p>You can use jq for that:</p>
<pre class="lang-bash prettyprint-override"><code>$ kubectl get pod -A -o json \
  | jq -r '.items[] | select(.spec.nodeSelector != null) | .metadata.namespace + &quot;/&quot; + .metadata.name + &quot;, &quot; + (.spec.nodeSelector | tostring)'
</code></pre>
<p>will return something like</p>
<pre class="lang-bash prettyprint-override"><code>&lt;namespace&gt;/&lt;podname&gt;, {&quot;key&quot;: &quot;value&quot;}
</code></pre>
<p>for all pods that are using a node selector.</p>
