Chapter 96: Flux GitOps — Sources, Reconciliation and Safe Local Practice
96.2 Desired state, manifests and Git revisions
Fictional teaching story. At a fictional Nashik library, Meera and Ben write down the intended display colour before comparing it with the current display.
Why
A controller needs a precise intended value instead of a vague instruction such as “make it correct.”
What
Read one harmless object and one version marker.
How
A declarative object
Declarative means describing the result rather than prescribing every action. A ConfigMap stores non-confidential Kubernetes configuration. metadata.name names the object; data holds string values.
Immediate practice example
- Read the example from top to bottom. Do not send it to a real cluster.
apiVersion: v1
kind: ConfigMap
metadata:
name: classroom-colour
data:
colour: blue
- Read the expected result.
Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.
The intended ConfigMap contains colour=blue.
- Understand each line in plain English.
apiVersion: v1 selects the core API. kind says ConfigMap, not Secret. The indented name belongs to metadata. The last two lines define a harmless text setting. A real API server would still enforce its schema and permissions; this example was only read locally.
A Git revision is evidence of a source version
A Git revision identifies a source state, commonly by commit. A branch is a moving reference; a revision tells you which state was fetched or applied. A diff shows what changed.
Immediate practice example
- Read the example from top to bottom. Do not send it to a real cluster.
Desired revision: demo-revision-B
Observed applied revision: demo-revision-A
Diff: colour changed from blue to green
- Read the expected result.
Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.
The application controller has not yet reported applying the desired revision.
- Understand each line in plain English.
The two revision names are fictional labels, not valid commit hashes. A branch named main can move while a controller still reports an older applied revision. Review both the diff and status before concluding that a change has taken effect. A revision identifier is not itself a signature or approval.
Ravindra Bagale's Tip
Ask which revision was applied, not only which branch was selected.
फक्त branch कोणती ते नका विचारू; कोणती revision apply झाली ते बघा.
सिर्फ branch नहीं, कौनसी revision apply हुई यह देखो.
Did you understand? Let us try it once more.