<p><strong>Goal :</strong> Have one pod (namely 'log-scraper') get scheduled on every node at least once but no more than once</p>
<p><strong>Assume a cluster has the following nodes</strong></p>
<p>Nodes</p>
<ol>
<li>master/control-plane</li>
<li>worker-1</li>
<li>worker-2</li>
<li>worker-2</li>
</ol>
<p><strong>Pod I'm working with</strong></p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: log-scraper
spec:
  volumes:
  - name: container-log-dir
    hostPath:
      path: /var/log/containers
  containers:
    - image: &quot;logScraper:latest&quot;
      name: log-munger
      volumeMounts:
      - name: container-log-dir
        mountPath: /var/log/logging-app
</code></pre>
<p>Adding affinity to select only 'worker' nodes (or non-mater nodes)</p>
<pre><code>  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
            - key: &quot;worker&quot;
              operator: In
              values:
              - &quot;true&quot;
</code></pre>
<p><strong>Question 1:</strong> How do I ensure every <code>node</code> runs <strong>ONE-AND-ONLY-ONE</strong> <code>pod</code> of type <code>log-scraper</code></p>
<p><strong>Question 2:</strong> What other manifests should be applied/added to achieve this?</p>

JumbledCode
<p>You should probably use <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/" rel="noreferrer">Daemonsets</a> which are exactly made for this purpose of scheduling one pod per node and gets automatically added to new nodes in case of cluster autoscaling.</p>
