Use this when describing systems declaratively.
Declarative Configuration
Declarative configuration describes what the system should look like, such as Kubernetes manifests or Terraform files, rather than the steps to get there, which makes GitOps reconciliation possible.
1. Configuration is declarative (manifests, Kustomize, Helm values).
2. Render and validate in CI.
3. Avoid imperative scripts in pipelines.
4. Pin chart versions.
5. Diff before merge.
declarative files → render → validate
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
git diff --checkPrimary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Command read-back and what it shows Verify boundary
git diff --check is the bounded verification surface selected for GitOps → Declarative Configuration. A known-good result is the intended declarative files are committed to the approved revision, the controller observes that same revision, rendered objects match expectation and managed resources reach their defined ready state. Treat uncommitted or unexpected desired changes remain, controller revision lags/diverges, render/apply errors occur, or the observed revision is current while resources remain unhealthy as broken/suspicious. git diff --check shows local patch whitespace/error checks for the selected working tree, but it does not show controller reconciliation, admission success or resource health.
Step 2 Observation-driven branch and next-check logic Narrow the fault
For a failing GitOps → Declarative Configuration case, freeze scope first: target/object, desired revision or request, and failure time. Inspect git diff --check. Branch on evidence rather than labels: if local desired files differ unexpectedly from HEAD, resolve authoring state first; if repository state is correct but controller observes another revision, inspect source/ref synchronization; if revision matches but resources are not ready, move to render/apply errors and resource conditions.
Step 3 Common mistakes Narrow the fault
- Imperative scripts mixed into declarative repos.
- Declarative config describes the end state.
- It enables reconciliation by controllers.
- Examples: Kubernetes manifests, Terraform.
kubectl diff -k <path>— declarative diffkustomize build <path> | kubeconform -strict— validate manifestshelm template <chart> -f values.yaml— render Helm
ReferenceHow it works1 section · depth on demand
How it works
In GitOps → Declarative Configuration, effective state is split across declarative source files, the committed desired revision, generated/rendered manifests and the reconciliation object that maps repository intent to managed resources. GitOps separates authoring from reconciliation: repository state declares intent, a controller observes a revision and renders or applies objects, and managed-resource status reports whether the observed generation has converged. Branch protection, renderer versions, overlays, secret references, controller credentials and cluster/API reachability are separate things to check. This matters because a clean local diff shows only the working tree matches HEAD, not that HEAD is the approved revision or that a controller has reconciled it.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Declarative configuration describes what the end result should be — "3 replicas of web:1.4", "VLAN 120 named users" — and leaves it to a tool to work out the steps. It contrasts with imperative scripts that list commands to run.
| Declarative | Imperative |
|---|---|
replicas: 3 | kubectl scale --replicas=3 |
| Terraform resource block | Series of API calls |
Resource module state: replaced | Sending CLI lines |
Declarative definitions are easier to diff, review and reconcile, and they double as documentation of the current design.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in GitOps > Declarative Configuration. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://opengitops.dev/ · confidence 94%