Kubernetes ds won't run pod on master node

2/11/2018

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
kubelet
kubernetes

2 Answers

2/11/2018

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
Source: StackOverflow

2/11/2018

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
Source: StackOverflow