Sequential Breakdown of the Process

Learn about the sequence of events involved in the process of creating a ReplicaSet.

We'll cover the following

Step by step process

The sequence of events that occur with the kubectl create -f go-demo-2.yml command is as follows:

  1. The Kubernetes client (kubectl) sends a request to the API server requesting the creation of a ReplicaSet defined in the go-demo-2.yml file.

  2. The controller is watching the API server for new events, and it detects that there is a new ReplicaSet object.

  3. The controller creates two new Pod definitions because we have configured the replica value as 2 in go-demo-2.yml file.

  4. Because the scheduler is also watching the API server for new events, it detects that there are two unassigned Pods.

  5. The scheduler decides which node to assign the Pod to and sends that information to the API server.

  6. The kubelet is also watching the API server. It detects that the two Pods are assigned to the node it is running on.

  7. The kubelet sends requests to Docker requesting the creation of the containers that form the Pod. In our case, the Pod defines two containers based on the mongo and the api image. So in total, four containers are created.

  8. Finally, the kubelet sends a request to the API server notifying it that the Pods are created successfully.

Get hands-on with 1200+ tech skills courses.