<p>In Kelsey Hightower's Kubernetes Up and Running, he gives two commands :</p>

<p><code>kubectl get daemonSets --namespace=kube-system kube-proxy</code></p>

<p>and</p>

<p><code>kubectl get deployments --namespace=kube-system kube-dns</code></p>

<p>Why does one use daemonSets and the other deployments?
And what's the difference?</p>

<p><strong>Kubernetes deployments</strong> manage stateless services running on your cluster (as opposed to for example StatefulSets which manage stateful services). Their purpose is to keep a set of identical pods running and upgrade them in a controlled way. For example, you define how many replicas(<code>pods</code>) of your app you want to run in the deployment definition and kubernetes will make that many replicas of your application spread over nodes. If you say 5 replica's over 3 nodes, then some nodes will have more than one replica of your app running.</p>
<p><strong>DaemonSets</strong> manage groups of replicated Pods. However, DaemonSets attempt to adhere to a one-Pod-per-node model, either across the entire cluster or a subset of nodes. A Daemonset will not run more than one replica per node. Another advantage of using a Daemonset is that, if you add a node to the cluster, then the Daemonset will automatically spawn a pod on that node, which a deployment will not do.</p>
<p><code>DaemonSets</code> are useful for deploying ongoing background tasks that you need to run on all or certain nodes, and which do not require user intervention. Examples of such tasks include storage daemons like <code>ceph</code>, log collection daemons like <code>fluentd</code>, and node monitoring daemons like <code>collectd</code></p>
<p>Lets take the example you mentioned in your question: why is<code>kube-dns</code> a deployment and<code>kube-proxy</code> a daemonset?</p>
<p>The reason behind that is that <code>kube-proxy</code> is needed on every node in the cluster to run IP tables, so that every node can access every pod no matter on which node it resides. Hence, when we make <code>kube-proxy</code> a <code>daemonset</code> and another node is added to the cluster at a later time, kube-proxy is automatically spawned on that node.</p>
<p><code>Kube-dns</code> responsibility is to discover a service IP using its name and only one replica of <code>kube-dns</code> is enough to resolve the service name to its IP. Hence we make <code>kube-dns</code> a <code>deployment</code>, because we don't need <code>kube-dns</code> on every node.</p>
