0

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?

  • The thing you're looking for sounds like [`DaemonSet`](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/), is that it? – mdaniel Jul 23 '22 at 21:01

1 Answers1

0

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:
      ...
SYN
  • 1,751
  • 8
  • 14