Use different name of the kustomization.yaml
Currently there is no possibility to change the behavior of kustomize
to support other file names (by using precompiled binaries) than:
kustomization.yaml
kustomization.yml
Kustomization
All of the below cases will produce the same error output:
kubectl kustomize dir/
kubectl apply -k dir/
kustomize build dir/
Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'FULL_PATH/dir'
Depending on the CI/CD platform/solution/tool you should try other way around like for example:
- split the
Deployment
into 2 directorieskustomization_deploy
/kustomization_rollback
withkustomization.yaml
As a side note!
File names that kustomize uses are placed in the:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/constants/constants.go
// Package constants holds global constants for the kustomize tool.package constants// KustomizationFileNames is a list of filenames that can be recognized and consumbed// by Kustomize.// In each directory, Kustomize searches for file with the name in this list.// Only one match is allowed.var KustomizationFileNames = []string{ "kustomization.yaml", "kustomization.yml", "Kustomization",}
The logic behind choosing the
Kustomization
file is placed in:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go
Additional reference: