<p>Does Kubernetes GET API actually support <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/" rel="noreferrer"><code>fieldSelector</code> parameter</a> to query values of array fields? </p>

<p>For example, I have a Pod like:</p>

<pre><code>apiGroup: v1
kind: Pod
metadata:
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: grpc-ping-r7f8r-deployment-54d688d777
    uid: 262bab1a-1c79-11ea-8e23-42010a800016
</code></pre>

<p>Can I do something like:</p>

<pre><code>kubectl get pods --field-selector 'metadata.ownerReferences.uid=262bab1a-1c79-11ea-8e23-42010a800016'
</code></pre>

<p>This command fails (<em><code>field label not supported: metadata.ownerReferences.uid</code></em>). I suspect the reason is that <code>ownerReferences</code> is an array field itself. I've also tried, but didn't work:</p>

<ul>
<li><code>metadata.ownerReferences[*].uid=</code></li>
<li><code>metadata.ownerReferences[].uid=</code></li>
</ul>

<p>I might try client-go SDK for Kubernetes API, but I suspect it won't work for the same reason.</p>

<p>Is there a server-side way to query by this? Thanks much. </p>

ahmet alp balkan
<p>The <code>--field-selector</code> only works with some limited fields.</p>
<p>Which contains:</p>
<pre><code>&quot;metadata.name&quot;,
&quot;metadata.namespace&quot;,
&quot;spec.nodeName&quot;,
&quot;spec.restartPolicy&quot;,
&quot;spec.schedulerName&quot;,
&quot;spec.serviceAccountName&quot;,
&quot;status.phase&quot;,
&quot;status.podIP&quot;,
&quot;status.podIPs&quot;,
&quot;status.nominatedNodeName&quot;
</code></pre>
<ul>
<li><a href="https://github.com/kubernetes/kubernetes/blob/9d577d8a29893062dfbd669997396dbd01ab0e47/pkg/apis/core/v1/conversion.go#L33" rel="noreferrer">Reference</a></li>
</ul>
<p>But you can perform the task by using <code>jq</code>. Here is a command that I used for listing all ready nodes. It demonstrates the use of array fields that you're looking for.</p>
<pre class="lang-bash prettyprint-override"><code>$ kubectl get nodes -o json | jq -r '.items[] | select(.status.conditions[] | select(.type==&quot;Ready&quot; and .status==&quot;True&quot;)) | .metadata.name '

master-0
node-1
node-3
</code></pre>
