How to set a different namespace for child helm charts?

krishonadish picture krishonadish · Jun 28, 2018 · Viewed 17.5k times · Source

When you install a chart with a child chart that doesn't specify a namespace, Helm will use the one specified on command line via --namespace. Is it possible to override this flag for a specific child chart?

For example if I have chart A which depends on chart B and I specify --namespace foo, I want to be able to customize the resources of chart B to be installed into some other namespace bar instead of foo.

Answer

itaysk picture itaysk · Jul 2, 2018

Update 2: Helm 3 added support for multi namespaces https://github.com/helm/helm/issues/2060

Update 1: If a resource template specifies a metadata.namespace, then it will be installed in that namespace. For example, if I have a pod with metadata.namespace: x and I run helm install mychart --namespace y, that pod will be installed in x. I guess you could use regular helm templates with the namespace to parameterize it.

Original answer:

We do not plan on fully supporting multi-namespaced releases until Helm 3.0 https://github.com/kubernetes/helm/issues/2060#issuecomment-306847365

As a workaround, you install for each namespace individually using --skip-dependencies or with dependency conditions