<p>Sometimes k8s nodes are labelled as <code>k8s.infra/postgres=</code> . Is this a valid label for a node ?</p>
<p>How do we use this kind of label whilst adding node affinities in our Deployment manifests ?</p>
<pre><code>    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: k8s.infra/postgres
                operator: Exists
                values:
                - 
                - 
</code></pre>

nevosial
<blockquote>
<p>Sometimes k8s nodes are labelled as k8s.infra/postgres= . Is this a valid label for a node?</p>
</blockquote>
<p>Yes, it is a valid label. The type the key is a <code>string</code> and the value is also a <code>string</code> but the value can be empty <code>string</code>: <code>&quot;&quot;</code>.</p>
<blockquote>
<p>How do we use this kind of label whilst adding node affinities in our Deployment manifests?</p>
</blockquote>
<p>The operators <code>Exists</code> and <code>DoesNotExist</code> only use <code>key:</code> and not <code>values:</code> so you can write:</p>
<pre><code>        - matchExpressions:
          - key: k8s.infra/postgres
            operator: Exists
</code></pre>
