Kustomizations can substitute variables such as ${NOTES_VERSION} from ConfigMaps. If one is missing, Flux aborts the build in strict mode. The running application stays unchanged – no image without a version.
Symptom
flux get kustomization notes NAME REVISION SUSPENDED READY MESSAGE notes main@sha1:d8043e69 False False post build failed for 'Deployment.v1.apps/notes': envsubst error: variable substitution failed: variable not set (strict mode): "NOTES_VERSION"
READY False, the message names the object and the variable.
Diagnosis
The cause in the course: a typo in the key of the ConfigMap cluster-vars.
sed -i 's/ NOTES_VERSION:/ NOTES_VERSON:/' clusters/lab/cluster-vars.yaml git commit -am "Tippfehler"
Causes
postBuildVariable missing from the ConfigMap
The Deployment uses ${NOTES_VERSION}; the values come from a ConfigMap via postBuild. A typo in the key leaves the variable missing.
strict modeFlux aborts instead of substituting empty
Flux substitutes variables in strict mode: if a variable without a default is missing, the build aborts and nothing is applied. The image therefore does not become notes-api: without a version.
Fix
git revert --no-edit HEAD git push flux reconcile kustomization flux-system --with-source flux reconcile kustomization notes ✔ applied revision main@sha1:c1eb001d3263eb43ffb4e4ed64d3aaefddced91e
Don't: Adding defaults like ${NOTES_VERSION:=latest} everywhere so the build never fails. Then a typo silently rolls out latest.
Flux hands-on, day 4: Kustomizations with wait, dependsOn and variables from postBuild.
Go to day 4 →
FAQ
Does the image become notes-api: without a version?
No. In strict mode the build aborts and Flux applies nothing.
When do I use variables, when overlays?
Variables for a few values per cluster; differences between environments are better handled with Kustomize overlays, where you see every file as it is applied.