|
|
|
|
|
by hinkley
2220 days ago
|
|
> You can't expect kubernetes scheduler to enforce anti-affinites for your pods. You have to define them explicitly. Why isn't this the default behavior? Why don't I have to go in and tell it that it's okay to have multiple instances on the same node? Why? So that I somehow feel like I've contributed to the whole process by fixing something that never should break in the first place? I know of a few pieces of code where I definitely want to run N copies on one machine, but for all of the rest? Why am I even running 2 copies if they're just going to compete for resources? |
|
If configured as suggested, and for some reason you lose enoguh nodes in your cluster for not having single node for each of your replicas, you will have less replicas than you intended, since the scheduler can't schedule a pod to a node where identical pod is already running.
Additionally, the affinity and anti affinity features are costly from the cluster perspective, so the configuration recommended by the author cost you performance.
And why isn't Kubernetes doing the obvious thing and spread apart your pods? well, it's simple - it does the right thing:
https://v1-15.docs.kubernetes.io/docs/concepts/scheduling/ku...
The first scoring parameter is SelectorSpreadPriority.