<p>I'm running this command:</p>
<pre><code># kubectl get pods --all-namespaces --field-selector=metadata.namespace!=kube-system,metadata.namespace!=monitoring,metadata.namespace!=rtf
</code></pre>
<p>Which gives me output like this:</p>
<pre><code>NAMESPACE                        NAME              READY   STATUS    RESTARTS   AGE
123456-1234-1234-1234-123456789  some-app-123456   2/2     Running   0          10m
123456-1234-1234-1234-123456789  some-app-789112   1/2     Running   0          10m
</code></pre>
<p>I would like to be able to filter on the READY column, but I can't seem to find the right field-selector value.</p>
<p>Is this possible?</p>
<p>I've tried searching around for a list of available field-selectors, and haven't had any luck. It's possible that one doesn't exist.</p>

michaeldpotter
<p>I don't think <code>kubectl get pods</code> supports <code>field selectors</code> based on the <code>READY</code> column directly.</p>
<p>But <code>kubectl</code> provides a method exporting the resource configuration (YAML) directly into <code>JSON, -o json</code>. Then, we can use <code>jq</code> to read, parse, and mutate K8s object results from <code>kubectl</code>.</p>
<p>In your case, you could use a command like this to filter all pods (excluding the <code>pods</code> from namespaces <code>kube-system</code>, <code>monitoring</code> &amp; <code>rtf</code>) not in <code>ready</code> state:</p>
<pre><code>kubectl get pods --all-namespaces --field-selector=metadata.namespace!=kube-system,metadata.namespace!=monitoring,metadata.namespace!=rtf -ojson | jq '.items[] | select(.status.containerStatuses[].ready==false) | .metadata.namespace + &quot;/&quot; + .metadata.name'
</code></pre>
<p>and/or change <code>ready=true</code> to get the pods in <code>ready</code> state.</p>
<p>Have a look at <a href="https://medium.com/geekculture/my-jq-cheatsheet-34054df5b650" rel="nofollow noreferrer">this</a> article for many more such uses of <code>jq</code> with <code>kubectl</code></p>
<p>Hope it helps.</p>
