What happens when you run kubectl apply
Kubernetes manifest: you write what you want, never how
Most programs wait for orders. Then they follow the orders one step at a time. A Kubernetes manifest is the YAML file you give the cluster, and it holds no steps at all.
-
1
You start writing Kubernetes a list of orders, step by step. It grows long, and it never ends: what if a node stops at 3 in the morning?
-
2
The control plane offers a better deal. You say what you want in the end, and it finds the steps itself.
-
3
So your file holds only the result: 3 copies of your image, running. A file like this is called a manifest.
-
4
Kubernetes works from that result, your desired state. Finding the steps is its job now, again and again: when a node stops, the desired state still says 3.
-
5
Jump ahead a little: you send this file with that one line, and seconds later 3 containers run on nodes you never touched. Who did all of that?
-
Quick check
Two lines for your next file.
Show the answer
"3 containers running". A manifest names the result you want. Picking a node and starting a container are steps, and Kubernetes finds them itself.
-
Go further
The two ways of asking, and the way a manifest is written.