According to https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
Note: Pod anti-affinity requires nodes to be consistently labelled, in other words every node in the cluster must have an appropriate label matching topologyKey. If some or all nodes are missing the specified topologyKey label, it can lead to unintended behavior.
What exactly will happen when there is no topologyKey label? Pods will be placed anywhere and everything will be working or I should expect some errors.
CodePudding user response:
After testing, it seems to ignore podAntiAffinity
when topologyKey is missing.
CodePudding user response:
- [From Kubernetes documentation]
There are currently two types of node affinity, called requiredDuringSchedulingIgnoredDuringExecution
and
preferredDuringSchedulingIgnoredDuringExecution
.
You can think of them as "hard" and "soft" respectively, in the sense that the former specifies rules that must be met for a pod to be scheduled onto a node
(pod will be in pending state ), while the latter specifies preferences that the scheduler will try to enforce but will not guarantee
(Pod will be scheduled to any available node).
I Think same rules aplly for nodeantiaffinity as well.