How to express : "Yo kubernetes, run 3 replicas, but at-least 1 of them must be running on a node with label cost=expensive
"
Lets say I have 2 sets of worker nodes(minions).
Set 1 with label cost=expensive
. Set 2 cost=cheap
.
I want to run a Deployment with 3 replica such that at-least one of them is scheduled on a Set 1, and I don't care where the other 2 replicas are launched.
notes:-
1.6.2
.podAntiAffinity
) spread pods across nodes; or (b) (nodeSelector
or nodeAffinity
) put soft/hard constraints on what selectors all pods will run.nodeSelector
set to cost=expensive
, but that makes it messy.I think you should run 2 deployments, pods in same deployment or replica set means same configuration, spread them to different kinds of custom node set is not the case. If you want them provide service together, you can set correct labels and make them work behind same service.
BTW, you can do this job by customizing scheduler policy, while that is too expansive.