Kubernetes kustomize command giving error when we specify base manifest files in kustomization.yaml file under resources section Kubernetes kustomize command giving error when we specify base manifest files in kustomization.yaml file under resources section kubernetes kubernetes

Kubernetes kustomize command giving error when we specify base manifest files in kustomization.yaml file under resources section


Kustomize doesn't allow you to directly include resource files that are not in the same directory or a subdirectory of where your kustomization.yml file is located.

The usual way to use a base in your overlay is to add a kustomization.yml file in the base and include the base directory in the kustomization.yml of your overlay. For example:

k8s/kustomize/base/kustomization.yaml:

resources:- deployment.yaml- service.yaml- configmap.yaml- secret.yaml

and in k8s/kustomize/overlays/test/kustomization.yaml:

resources:- ../../base- namespace.yamlnamespace: app-testcommonLabels:  variant: test  app: test-apppatchesStrategicMerge:- secret.yaml- configmap.yaml


Maybe something change because the following example does that the question was trying to do: https://kubectl.docs.kubernetes.io/references/kustomize/resource/

apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationresources:- myNamespace.yaml- sub-dir/some-deployment.yaml- ../../commonbase- github.com/kubernetes-sigs/kustomize/examples/multibases?ref=v1.0.6- deployment.yaml- github.com/kubernets-sigs/kustomize/examples/helloWorld?ref=test-branch