<p>I'm deploying my service under my namespace. We have a worker node farm and my service will only utilize a small subset of its nodes.</p>
<p>I want to deploy a DaemontSet of cAdvisors but I only want them to run in the nodes not related to my namespace. If possible, how to do that?</p>
<p>Thanks!</p>

H. Zhao
<p><code>ScheduleDaemonSetPods</code> is a kubernetes feature that allows you to schedule DaemonSets using the default scheduler instead of the DaemonSet controller, by adding the <code>NodeAffinity</code> term to the DaemonSet pods, instead of the <code>.spec.nodeName</code> term. <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#scheduled-by-default-scheduler" rel="nofollow noreferrer">Kubernetes Document</a></p>
<p>For example below k8s manifest will create Pods on nodes with <code>type=target-host-name</code>:</p>
<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: testdaemon
spec:
  template:
    metadata:
      labels:
        app: testdaemon
    annotations:
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: type
                operator: In
                values:
                - target-host-name
      containers:
      - name: testdaemon
        image: nginx
</code></pre>
