2

I am running a cluster with 1 master and 1 node. Now, when I run daemon set it only shows 1 desired node, while it should be 2. There is no error I could find anywhere in the describe/logs, but the daemonset only chooses 1 node to run. I am using kubernetes 1.9.1.

Any idea what I can be doing wrong? Or how to debug it? TIA.

Pensu
  • 3,263
  • 10
  • 46
  • 71
  • Usually the master would not be marked as being a node where you can schedule your application to run. Is there a reason you are expecting it to run on the master? – Graham Dumpleton Feb 11 '18 at 08:12

2 Answers2

21

This happens if the k8s master node has just the node-role.kubernetes.io/master: NoSchedule taint without toleration for it.

The the node-role.kubernetes.io/master: NoSchedule toleration is needed in k8s 1.6 or later to schedule daemonsets on master nodes.

Add the following toleration for the daemonset in the YAML file to make k8s schedule daemonsets on the master node too:

...
kind: DaemonSet
spec:
  ...
  template:
   ...
    spec:
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule

Taints of the master node can be checked by:

kubectl describe node <master node>

Tolerations of a pod can be checked by:

kubectl describe pod <pod name>

More info about daemonsets is in https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/.

Vikram Hosakote
  • 3,528
  • 12
  • 23
8

By default, your cluster will not schedule pods on the master for security reasons. If you want to be able to schedule pods on the master, e.g. for a single-machine Kubernetes cluster for development, run:

kubectl taint nodes --all node-role.kubernetes.io/master-

Ahab
  • 750
  • 4
  • 8
  • 2
    While this will work, it will have the added effect of *all* pods being eligible for scheduling on the node with a master taint removed. – Brian Topping May 03 '20 at 01:13
  • Running kubectl taint nodes --all node-role.kubernetes.io/master- allows workloads on master nodes. This can cause stability, security, and operational issues. Consider safer alternatives. – Sam Aug 18 '23 at 21:04