I have a Kubernetes cluster in which I would like to deploy various company dependent pods and services. All of them need some common components (e.g. ingress, traefik, postgres). Therefore I had designed a chart structure:
- myproject charts - ingress - traefik - postgres templates - svc1 - pod1 - svc2 - pod2
My idea was to control the company-dependent pods/services via environment variables and do deployments like this: helm install --set env="dev" --set company="cat" ./myproject
or helm install --set env="prod" --set company="dog" ./myproject
svc1, svc2, ... read the env values.
Anyway, this construct doesn't work. I get an error that some common component already exists. I understand this. I think one way to avoid the problem would be to create a separate chart for ingress, traefik etc. and generate it first. But I have the feeling that this is not right way. What would be a good solution to solve this problem?
Are all the charts developed by you? or are you using 3rd party charts? Depending on how you are using the charts this might alter the solution.
Have you tried using something related to DRY? this article is very helpful for using DRY in helm.
Also, would be very helpful if you shared the error that is happening.