Lesson 2: The big idea — desired state vs actual state
This is the single idea to take from this lesson, and everything else in Kubernetes is built on top of it. Instead of running command after command yourself and hoping things stay healthy, you write one file that describes the "desired state" — how things should look, for example "keep 3 copies of t
It is like a thermostat: you set it to 22 degrees, and the device keeps checking the temperature and turns on or off so reality matches what you asked for.
- Desired State
- The description you declare in a file — how the system should look: which components run, how many replicas, and with which configuration. It is the "target" Kubernetes aims for.
- Actual State
- What is really running in the cluster at a given moment — how many Pods are alive right now and their status. This is what Kubernetes measures and compares against the desired state.
- Reconciliation
- The ongoing loop in which Kubernetes compares the actual state to the desired state, and if there is a gap, acts to close it (creating, deleting, or replacing components) until the two match.
- Declarative Configuration
- An approach where you describe the end result you want ("keep 3 replicas") and let the system decide how to get there — as opposed to the imperative approach where you give each step yourself.