4
overlays -----> configuration1 ----> kustomization.yaml 
         |   
         |----> configuration2 ----> kustomization.yaml


resources ------> kustomization.yaml

# in file resources/kustomization.yaml
# for configuration1 
resources:
  - pvc.yaml
  - deployment.yaml
  - namespace.yaml

# for configuration2
resources:
  - pvc.yaml
  - network.yaml
  - istio.yaml

end goal

kubectl apply -k overlays/configuration1
kubectl apply -k overlays/configuration2

I have an overlays folder that contains two folders. configuration1 and configuration2. In those folders I have a kustomization.yaml file. These two kustomization files call the same resource folder. configuration1 and configuration2 need to have a different list of resources specified. Can I create two different kustomize.yaml files in the resource folder or is there anyway to specify two different list of resources in the same kustomization.yaml?

Stormy Weather
  • 295
  • 1
  • 4
  • 12

1 Answers1

1

In this case it would use the following structure:

base/
  kustomization.yaml
  pvc.yaml
overlays/
  configuration1/
    kustomization.yaml
    deployment.yaml
    namespace.yaml
  configuration2/
    kustomization.yaml
    network.yaml
    istio.yaml

base/kustomization.yaml:

resources:
  - pvc.yaml

overlays/configuration1/kustomization.yaml:

resources:
  - ../../base
  - namespace.yaml
  - deployment.yaml

overlays/configuration2/kustomization.yaml:

resources:
  - ../../base
  - network.yaml
  - istio.yaml

The idea is to keep in the base the configuration that is common to both and move to each overlay the configuration specific to it.

ITChap
  • 4,057
  • 1
  • 21
  • 46