How kubernetes daemonset works?

9/6/2020

I have a doubt, hope you would help.

Suppose I have 4 node and created a deployment with ReplicaSet value is 3 with pod spec having label xyz. Now creating one DaemonSet with pod having label xyz which is same mentioned above. Now finally how many pods will be there 4 or 3 and how does it work?

Please reply soon.

-- ankit mishra
daemonset
kubernetes

2 Answers

9/6/2020

Well it will be 7 pods in total because deployment and daemonsets are complete different terms. In real world Deployment mainly used for deploying business related applications which serve request coming from end user. On the other hand daemonsets runs on each node the use case of daemonsets would be collecting logs from different worker nodes. And it’s the right purpose. No matter what if you add new node to your Kubernetes cluster daemonsets will spin up the pod on that new node also. I hope you got the clear understanding the use of deployment and daemonsets

In nutshell

Deployment: Host business related application

Daemonsets: Used in monitoring cluster and gathering logs from different worker nodes

-- Dashrath Mundkar
Source: StackOverflow

9/6/2020

Total pods would be 7, 3 created by deployment, and 4 would be created by DamemonSet on each node.

A DaemonSet deploys pods to all nodes in the cluster.

As per Kubernetes docs :-

you should not normally create any pods whose labels match this selector, either directly, with another ReplicationController, or with another controller such as Job. If you do so, the ReplicationController thinks that it created the other pods. Kubernetes does not stop you from doing this.

If you do end up with multiple controllers that have overlapping selectors, you will have to manage the deletion yourself

-- Deepak
Source: StackOverflow