<p>I would like to use <em>podAffinity</em> with <em>matchFields</em>.
On the web I only found examples with field metadata.name :</p>
<pre><code>- matchFields:
  - key: metadata.name
    operator: NotIn
    values:
    - worker-1
</code></pre>
<p>I would like to know if there are any other valid node fields I can use and how/where I can find them?</p>
<p>Thx in advance</p>

<p>I did some digging and I found out that <code>Matchfields</code> was introduced because of the issue with scheduling <code>DaemonSets</code>. The Controller that creates pod was depending the <code>kubernetes.io/hostname</code> label on a Node. This whole setup was assuming that this label is being equal to the node name which turned out wrong one becuase node name and <code>hostname</code> are distinct in some cases. See <a href="https://github.com/kubernetes/kubernetes/issues/61410" rel="nofollow noreferrer">#61410</a> for more reading.  This also explains why there example of using this is only related to DaemonSet in the docs.</p>
<p>Because of that  PR #<a href="https://github.com/kubernetes/kubernetes/pull/62002" rel="nofollow noreferrer">62002</a> was merged which added <code>MatchFields</code> to <code>NodeSelectorTerm</code> with the release note that explains that only <code>metadata.name</code> is being supported:</p>
<pre><code>Added `MatchFields` to `NodeSelectorTerm`; in 1.11, it only support `metadata.name`.
</code></pre>
<p>So at the time of this writing the only supported field is <code>metadata.name</code>. I've check also <a href="https://github.com/k82cn/kubernetes/blob/master/pkg/apis/core/validation/validation_test.go#L8050-L8075" rel="nofollow noreferrer">tests code</a> and it appears that this behavior has not changed till now.</p>
<p>PS. Please note that this can only be used in <code>NodeSelector</code> and not applicable in <code>PodAffinity/PodAntiAffinity</code></p>
