<p>I'm just starting to explore Kubernetes, and there is one thing I find unclear. Suppose I have a master node that I have set up with <code>kubeadm</code>, and another two worker nodes that I had joined to master. Now I have a yaml file that specifies the details of a <code>Deployment</code> and I need to run:</p>

<pre><code>kubectl create -f dep.yaml
</code></pre>

<p>Do I need to run this command on master only? and then the master may or may not decide to use both worker nodes for the deployment according to optimal load distribution? Or do I need to run this in all worker nodes?</p>

<p>You don't have to. You just need to run this command once and <a href="https://kubernetes.io/docs/concepts/overview/components/#kube-scheduler" rel="nofollow noreferrer">kube-scheduler</a> will schedule it in appropriate node.</p>

<p>Look at the diagram of this page: <a href="https://kubernetes.io/docs/concepts/architecture/cloud-controller/" rel="nofollow noreferrer">Concepts Underlying the Cloud Controller Manager</a></p>

<p>Mster Nodes runs, <a href="https://kubernetes.io/docs/concepts/overview/components/#kube-apiserver" rel="nofollow noreferrer">kube-apiserver</a>, <a href="https://kubernetes.io/docs/concepts/overview/components/#etcd" rel="nofollow noreferrer">etcd</a>, <a href="https://kubernetes.io/docs/concepts/overview/components/#kube-scheduler" rel="nofollow noreferrer">kube-scheduler</a>, <a href="https://kubernetes.io/docs/concepts/overview/components/#kube-controller-manager" rel="nofollow noreferrer">kube-controller-manager</a> and <a href="https://kubernetes.io/docs/concepts/overview/components/#cloud-controller-manager" rel="nofollow noreferrer">cloud-controller-manager</a>.</p>

<p>kube-scheduler watches for newly created pod and schedule it to appropriate node based on resource requirements, hardware/software/policy constraints, affinity and anti-affinity etc.</p>
