Pods Creation Process Flow

MrDevSecOps
3 min readFeb 12, 2022

Let’s take an example with the above Kubernetes cluster.

Before we deploy any pods in the Kubernetes cluster, first we need to build the docker image that the pod will use.

Step1) Admin/developer will build a container image of the application that needs to be deployed in the cluster.

Once the image is ready they push that to the container repository such as Docker Hub.

Step2) Then developer writes the object configuration in the YAML or JSON format.

This YAML file includes specifications of the container image and its configuration, once it is ready, it is submitted to the Kube API server through kubectl command.

Kube API validates the object configuration by checking the user credential, whether he/she has permissions to perform this operation and other things.

Step3) If all checks are passed, then all configurations of the pods will save the configuration in the ETCD database then the API server will notify the scheduler to check the healthy node, here the scheduler may check memory, CPU, node capacity, labels, and more.

Step4) Once the scheduler finds the correct worker node, then the scheduler respective worker node to pods in the ETCD database through the Kube API server.

Step5) API server informs the kubelet running on the specific node and kubenet running on that worker node informs the container runtime interface ie. docker to start downloading the corresponding docker image and deploy pod on that node.

So far, they are no involvement of the control manager and Kube proxy.

The controller manager will get involved when we create pods using deployment or replica set, and the task of controllers is to make sure that these numbers of pods are always running as defined.

And KubeProxy gets involved when two pods need to be communicated using a service object, also playing a crucial role in pod networking and communication.

Below is an example of a pod YAML file with two containers.

Deploy the YAML file using kubectl command.

Once a pod gets created successfully, we can display the complete pod object details and events using the described command.

Here you can see the list of events that occur while creating this pod.

Here, the scheduler finds the worker node02 and pulls the Nginx Docker image and after successfully downloading these images it creates and starts the Nginx container.

Similarly, the Redis image is pulled and created and starts the Redis container.

Also, check

Kubernetes Tutorials

--

--

MrDevSecOps

Integrating security into the software development lifecycle.