Home > Blockchain >  kustomize share resources/patches with multiple overlays
kustomize share resources/patches with multiple overlays

Time:12-06

I have a kube-prometheus deployed to multiple environment using kustomize. kube-prometheus is a base and each environment is an overlay. Let's say I want to deploy dashboards to overlays, which means I need to deploy same ConfigMaps and same patch to each overlay. Ideally I want to avoid changing base as it is declared outside of my repo, and keep thinks DRY and not to copy same configs all over the place. Is there a way to achieve this?

Folder structure:

/base/
     /kube-prometheus/
/overlays/
     /qa/       <--- 
     /dev/      <--- I want to share resources patches between those
     /staging/  <---

EDIT: same path -> same patch

CodePudding user response:

The way to do it is components: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/components.md

Hope will help somebody in the future.

CodePudding user response:

In your main kustomization, or some top-level overlay, you should be able to call for a common folder or repository.

Have you tried something like this:

resources:
  - github.com/project/repo?ref=x.y.z

If this doesn't answer your question, could you please edit your post and give us some context?

  • Related