<p>is there any way to avoid execution of an application deployed as DaemonSet on master?<br>
I have seen that this is the expected behavior, but I would like to avoid execution in some way.   </p>

<p>Regular pods will not schedule on master but DaemonSet pods do.   </p>

<p>If yes, is it possible to set this information in the yml file (parameter..etc??)?</p>

<pre><code> kubectl create -f mydaemon.yml

logspri-4zwl4              1/1       Running           0          &lt;invalid&gt;   X.X.X.X   k8s-master-e7c355e2-0
logspri-kld2w              1/1       Running           0          &lt;invalid&gt;   X.X.X.X     k8s-agent-e7c355e2-0
logspri-lksrh              1/1       Running           0          &lt;invalid&gt;   X.X.X.X     k8s-agent-e7c355e2-1
</code></pre>

<p>I would like to avoid my pod is running on <code>k8s-master-e7c355e2-0</code></p>

<p>I have tried :   </p>

<pre><code>annotations:
          scheduler.alpha.kubernetes.io/affinity: &gt;
            {
              "nodeAffinity": {
                "requiredDuringSchedulingRequiredDuringExecution": {
                  "nodeSelectorTerms": [
                    {
                      "matchExpressions": [
                        {
                          "key": "kubernetes.io/role",
                          "operator": "NotIn",
                          "values": ["master"]
                        }
                      ]
                    }
                  ]
                }
              }
            }
</code></pre>

<p>Trying also to apply the following role  (as suggested) but it doesn't work :   </p>

<pre><code>kubectl get nodes
NAME                    STATUS                     AGE       VERSION
k8s-agent-e7c355e2-0    Ready                      49d       v1.5.3
k8s-agent-e7c355e2-1    Ready                      49d       v1.5.3
k8s-master-e7c355e2-0   Ready,SchedulingDisabled   49d       v1.5.3
</code></pre>

<p>Shall I perform:      </p>

<pre><code>VirtualBox:~/elk/logspout$ kubectl taint node k8s-master-e7c355e2-0 k8s-master-e7c355e2-0/ismaster=:NoSchedule
node "k8s-master-e7c355e2-0" tainted
</code></pre>

<p>Even if it seems that the master is tainted I see that the application is always on master.   </p>

<pre><code>Role:           
Labels:         beta.kubernetes.io/arch=amd64
            beta.kubernetes.io/instance-type=Standard_D2
            beta.kubernetes.io/os=linux
            failure-domain.beta.kubernetes.io/region=northeurope
            failure-domain.beta.kubernetes.io/zone=0
            kubernetes.io/hostname=k8s-master-e7c355e2-0
Annotations:        volumes.kubernetes.io/controller-managed-attach-detach=true
Taints:         &lt;none&gt;
CreationTimestamp:  Wed, 17 May 2017 14:38:06 +0200
Phase:          
Conditions:
</code></pre>

<p>What is wrong?
Could you give me the right command to perform?</p>

<p>same problem reported <a href="https://stackoverflow.com/questions/42134518/cluster-created-with-kops-deploying-one-pod-by-node-with-daemonset-avoiding-ma">here</a> without an apparent solution by :   </p>

<pre><code>kubectl taint nodes nameofmaster dedicated=master:NoSchedule
</code></pre>

<p>Thanks
Prisco</p>

<p>From <a href="https://github.com/kubernetes/kubernetes/issues/29108" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/29108</a>, you can add a taint flag to your Master node kubelet, so the even the pods in the DaemonSet are not scheduled there</p>

<pre><code>   --register-with-taints=node.alpha.kubernetes.io/ismaster=:NoSchedule
</code></pre>

<p>You will need to restart kubelet in your node</p>
