I am trying to apply kustomize from env/main/kustomization.yaml
directory
kubectl diff --kustomize .
which gives error:
`: security; file 'base/replacements/xxxx.yaml' is not in or below 'env/main'
The above kustomization is applied on the base directory base/kustomization
. If I run kubectl diff --kustomize .
directly in the base directory there is no error
. Running from env/main
gives the error.
contents of kustomization.yaml in env/main
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
images:
- ecr-image
replacements:
- path: ../../base/replacements/file1.yaml
- path: ../../base/replacements/file2.yaml
- path: ../../base/replacements/file3.yaml
configMapGenerator:
- literals:
- abc
contents of kustomization.yaml base/
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
transformers:
- tranxformers.yaml
configMapGenerator:
- name: xxx
namespace: name-space
envs:
- configs/env-file
resources:
- applications/deployment.yaml
Why replacements files path are causing this error? Also please explain me the cause of this problem which makes me understand the flow of kustomize in a better way
Update:
if I move the replacements directory inside env/main directory there is no error. But this is not ideal since I want to use the base directory even for replacements
I did tried to use replacements as components but its not replacing the desired valued