Can podaffinity schedule two pods to run on the same node?

7/12/2018

Both pods are scheduled on same node with podaffinity, each pod on a different namespace. Once I try to deploy both of them on same namespace, podaffinity fails, and one one pod is running while the other one remains pending with podaffinity error. Thanks!

-- Tzvika Avni
kubernetes
pod

1 Answer

7/13/2018

From your comment, I suspect that you have a label collision that is only apparent when you try to run the pods in the same namespace.

Take a look at your nodeSelectorTerms and matchExpressions

From the docs:

If you specify multiple matchExpressions associated with nodeSelectorTerms, then the pod can be scheduled onto a node only if all matchExpressions can be satisfied.

-- Dan O'Boyle
Source: StackOverflow