<p>I have installed K8S using Kubeadm and see the below pods across the control plane nodes and the worker nodes.</p>

<p><a href="https://i.stack.imgur.com/mHLtw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mHLtw.png" alt="enter image description here"></a></p>

<p>Kubelet is started as a systemd service, it looks at the /etc/kubernetes/manifests folder and starts the objects defined in the etcd.yaml, kube-apiserver.yaml, kube-controller-manager.yaml and kube-scheduler.yaml files. If I drop a yaml file in the same folder, kubelet observes the same and starts the appropriate K8S object.</p>

<p>I am not sure how the coredns Deployment, kube-proxy and the flannel DaemonSets shown in the above screenshot get automatically started once I start/reboot the control plane nodes and the worker nodes. Can someone help me with the K8S startup process for the same?</p>

Praveen Sripati
<p>Kubeadm installs CoreDNS and kube-proxy in <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/#cmd-phase-addon" rel="nofollow noreferrer">init addon</a> phase. It's being installed after basic cluster functionality is already started (apiserver, controller manager etc.). Kubeadm installs it the same way you would run <code>kubectl apply</code>.</p>

<p>Here is the <a href="https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/cmd/phases/init/addons.go#L43-L71" rel="nofollow noreferrer">code of kubeadm init addon phase</a> if you want to see how it actually works under the hood.</p>

<p>Apiserver, controller manager and scheduler have to be started using manifest folder (also known as <code>static pods</code>) because there is no other way (technically this is not 100% correct, because there are other methods, e.g. you can run your control plane using systemd). How do you start running stuff on kubernetes when there is no kubernetes yet? There is no api server to handle your requests, there is no scheduler to schedule your pods, there is no controller to manage resources.
After the essential components are started, you can run pods in a regular way using api.</p>

<p>Also, answering your question on what happens when you restart your control plane or nodes? You need to know that state of whole k8s cluster is hold in etcd. So when you reboot control plane, kubernetes reads state from etcd, compares it to reality and if there are differences, it adjusts reality to match the state in etcd. e.g. if there is no coredns running but there is coredns object in etcd, kubernetes is going to start it.</p>
