Flux Kustomize PostBuild Quick Fix - Post-Build Configuration
DodaTech
Updated 2026-06-26
1 min read
Flux Kustomize post-build substitutions replace variables in manifests after kustomize build. Incorrect substitution syntax or missing variables cause reconciliation failures. This guide covers the fix.
Quick Fix
Wrong
spec:
postBuild:
substitute:
image_tag: v1.0.0
replicas: "3"
The issue: variable names with underscores may not match references in the kustomize manifests. PostBuild substitution uses ${variable_name} syntax, and manifests may use different variable naming.
Right
spec:
postBuild:
substitute:
image_tag: "v1.0.0"
replicas: "3"
substituteFrom:
- kind: ConfigMap
name: build-vars
- kind: Secret
name: build-secrets
With the kustomize manifest referencing:
apiVersion: apps/v1
kind: Deployment
spec:
replicas: ${replicas}
template:
spec:
containers:
- image: myapp:${image_tag}
# Expected output after applying the fix
# PostBuild substitutes ${image_tag} → v1.0.0
# PostBuild substitutes ${replicas} → 3
# Variables also sourced from ConfigMap and Secret
# Kustomization applies with substituted values
Prevention
- Use
${variable_name}syntax in kustomize manifests for substitution - Quote values in
substituteto preserve string types - Use
substituteFromfor bulk variable loading from ConfigMaps/Secrets - Ensure variable names match exactly between substitute and manifest references
- Test substitutions with
flux build kustomization <name> --dry-run
DodaTech Tools
Doda Browser's substitution inspector shows resolved variable values. DodaZIP archives substitution configurations for audit. Durga Antivirus Pro validates substitution values for injection.
FAQ
← Previous
Flux Kustomize Patches Quick Fix - Strategic Merge Patches
Next →
Flux Kustomize Prune Quick Fix - Resource Pruning
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro