Sometimes k8s nodes are labelled as k8s.infra/postgres=
. Is this a valid label for a node ?
How do we use this kind of label whilst adding node affinities in our Deployment manifests ?
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: k8s.infra/postgres
operator: Exists
values:
-
-
Sometimes k8s nodes are labelled as k8s.infra/postgres= . Is this a valid label for a node?
Yes, it is a valid label. The type the key is a string
and the value is also a string
but the value can be empty string
: ""
.
How do we use this kind of label whilst adding node affinities in our Deployment manifests?
The operators Exists
and DoesNotExist
only use key:
and not values:
so you can write:
- matchExpressions:
- key: k8s.infra/postgres
operator: Exists
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With