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 kubeadm
, and another two worker nodes that I had joined to master. Now I have a yaml file that specifies the details of a Deployment
and I need to run:
kubectl create -f dep.yaml
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?
You don't have to. You just need to run this command once and kube-scheduler will schedule it in appropriate node.
Look at the diagram of this page: Concepts Underlying the Cloud Controller Manager
Mster Nodes runs, kube-apiserver, etcd, kube-scheduler, kube-controller-manager and cloud-controller-manager.
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.