I have a cluster with 3 masters and 3 nodes, the masters are untained and pods can be scheduled in them.
But I want the pod runs in nodes preferentially if their resources are enough only. Because the masters are very significant but resource in cluster is limited, so that they are untained.
In general, my goal is to let the pods run as much as possible on the node instead of the master.
Is there a
AlgorithmProvider achieve it?
Yes, you can use node affinity to make it.
Here is an example:
apiVersion: v1 kind: Pod metadata: name: with-node-affinity spec: affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 preference: matchExpressions: - key: node-type operator: In values: - worker containers: - name: with-node-affinity image: k8s.gcr.io/pause:2.0
Also, you need to label your node with `node-type=worker