K8S Pod creation process

Reference video: https://ke.qq.com/user/index/index.html#/plan/cid=1709963&term_id=102815140

1. Flow chart

Insert picture description here

Second, the specific process

0.kubectl apply -f pod.yaml

1.kubectl converts the yaml file to json, submits it to apiserver, and apiserver stores the data in etcd

2. The scheduler monitors the event of creating a new Pod through the list watch mechanism, and schedules it to the Node according to the Pod attributes. At the same time, the Pod is labeled to indicate which node is scheduled to, which can be kubectl get pod -owideviewed

3. The apiserver gets the scheduling result and writes it to etcd

4.kubelet obtains the Pod assigned to its node from the apiserver

5.kubelet calls Docker's /var/run/docker.sock to create a container

6.Docker creates a container based on kubelet requirements and reports the status of the container to kubelet

7.kubelet updates Pod status to apiserver

8. Apiserver writes status information to etcd

9.kubectl get pod

Three, Pod event

Insert picture description here
From the event, we can see that the Pod will be scheduled to the Node first, then the image will be pulled, and finally the container will be created and started

Guess you like

Origin blog.csdn.net/anqixiang/article/details/108685985