Doubts creating a DaemonSet

Hi, I don’t know if it is the correct channel, otherwise sais me the correct, please. If I have 3 nodes, 2 workers and one master, and I have to create a DaemonSet with an nginx image, how many pods, must be create? 2 one por each worker node. 3 one for node. what will be the daemonset file do? Thanks Regards

Hi @juanpi9,
DaemonSet: ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. so at the last, it runs a pod. and master node has taint to prevent schedule pod on it. so by default it run on all worker. but if you want run it on master you can add:

tolerations:
      # this toleration is to have the daemonset runnable on master nodes
      # remove it if your masters can't run pods
      - key: node-role.kubernetes.io/master
        effect: NoSchedule

for more info about daemonset you can check the following link https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

Thanks for your answer. I would want to difference, by the exam, if the question sais:

“Make sure a single instance of Pod is running on each node of the Kubernetes cluster”

All nodes include Master or only worker-nodes?

You can use this add that I mention to the file to ensure that run on master and worker nodes as well.

1 Like