Chapter 96: Flux GitOps — Sources, Reconciliation and Safe Local Practice
96.3 Controllers, custom resources and the reconciliation loop
Fictional teaching story. At a fictional Satara school, Ravi and Eva use separate staff roles for receiving lesson material and arranging the classroom.
Why
Separating responsibilities helps locate failures without repeatedly changing the application YAML.
What
Connect object type, controller responsibility and status.
How
Controllers and custom resource definitions
A controller is a running program that observes objects and performs reconciliation. A custom resource definition (CRD) adds an object type to Kubernetes. A custom object is configuration, not the controller program.
Immediate practice example
- Read the example from top to bottom. Do not send it to a real cluster.
GitRepository object -> source-controller
Kustomization object -> kustomize-controller
HelmRelease object -> helm-controller
- Read the expected result.
Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.
Different controllers own different stages.
- Understand each line in plain English.
The first line connects a Git source description with artifact fetching. The second connects a desired directory with build/apply reconciliation. The third connects Helm release configuration with Helm reconciliation. Creating a YAML file locally neither installs its CRD nor starts its controller.
Status is observed information
A condition reports a status such as Ready with a reason and message. Generation changes when object specification changes; observedGeneration helps show whether status has caught up with that specification.
Immediate practice example
- Read the example from top to bottom. Do not send it to a real cluster.
metadata.generation: 4
status.observedGeneration: 3
Ready: False
Reason: illustrative pending reconciliation
- Read the expected result.
Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.
The displayed status is not yet evidence about specification generation 4.
- Understand each line in plain English.
The first line identifies the newer requested specification. The second records an older observed generation. The last two lines are a teaching summary, not an exact Flux status dump. Check the actual condition, reason, message and revision together; Ready on a source does not prove application health.
Ravindra Bagale's Tip
An object, its CRD and its running controller are three different things.
Object, त्याची CRD आणि चालणारा controller या तीन वेगळ्या गोष्टी आहेत.
Object, उसकी CRD और चलने वाला controller तीन अलग चीजें हैं.
Did you understand? Let us try it once more.