I want every Kubernetes node to have the same set of pods on it.
If I scale up a deployment, I want the new pods to go on new cluster nodes that I scaled up.
Do I use required node affinity for this?
I want every Kubernetes node to have the same set of pods on it.
If I scale up a deployment, I want the new pods to go on new cluster nodes that I scaled up.
Do I use required node affinity for this?
As suggested in comments: for Nodes to run the same set of Pods, you're looking for a DaemonSet.
While the Deployment lets you control how many replicas you want, the DaemonSets relies on its nodeSelector to schedule one replica per node matching that selector.
By default (if you do not set any nodeSelector), Pods would be scheduled on all nodes. Some tolerations may be needed, depending on nodes taints:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: foo
spec:
selector:
matchLabels:
foo: bar
template:
metadata:
labels:
foo: bar
spec:
tolerations:
- operator: Exists
containers:
...