Object Create Path

You apply a single Deployment, and moments later a Pod runs on some Node, though you never created a ReplicaSet or picked the Node yourself. Who did all of that in between, and in what order did it happen?

Play the animation 7 steps, animated, plays on a computer or a tablet

Object Create Path diagram: The object create path, where a manifest travels from the client through the control

Object Create Path, step by step

  1. You run kubectl apply -f deploy.yaml. The client serializes the manifest as JSON and POSTs it to /apis/apps/v1/namespaces/default/deployments on the API. If the object already exists, the client sends a three-way merge PATCH instead, and Server-side Apply is the same PATCH under its own content type.

    Play from step 1
  2. The API authenticates you from your kubeconfig, checks RBAC, runs admission and schema validation, then writes the new Deployment my-app to ETCD. ETCD commits the write via Raft quorum at rv=842.

    Play from step 2
  3. ETCD tells the API that the write is committed at rv=842, and the API returns HTTP 201 Created to the kubectl client. The Deployment now exists in cluster state, but no Pods have been created yet.

    Play from step 3
  4. The Deployment controller, inside the controller-manager, sees my-app via its watch on the API and creates a ReplicaSet (my-app-7d4). The ReplicaSet controller sees my-app-7d4 on its own watch and creates a Pod (my-app-7d4-x2k9p) with no nodeName yet. No controller calls another.

    Play from step 4
  5. The Scheduler picks up my-app-7d4-x2k9p, filters candidate Nodes (taints, resources, affinity), scores the survivors on free resources and topology spread, then posts a Binding that pins the Pod to Node-1. That write goes through the API into ETCD like the first one.

    Play from step 5
  6. The Kubelet on Node-1 has a filtered watch on /api/v1/pods?fieldSelector=spec.nodeName=Node-1. The API streams my-app-7d4-x2k9p down that watch to Node-1, and there the Kubelet picks the Pod up.

    Play from step 6
  7. The Kubelet drives the Runtime over CRI, one call at a time. It asks first for a Pod sandbox, which gives the Pod its network namespace and IP, then for the nginx:1.30 image, then for the container to start in that sandbox. The Pod my-app-7d4-x2k9p is now Running on Node-1.

    Play from step 7

Sources