Search code examples
kubernetes-helmbitnamikubernetes-secretskubernetes-deployment

Helm - how to add secrets for subchart from repo?


I installed mongodb chart from bitnami as follows

helm install mongodb bitnami/mongodb 

which created this file ./charts/mongodb-10.15.2.tgz

What I do not understand and what I cant find is how to link Secrets to these kind of subcharts. I am aware that values.yaml can override child subcharts. What really confuses me is that this downloaded subchart is just encoded file and I have absolutely no idea how to bend it in terms of deployment/service...

Therefore my question is, how to supply this subchart (of which I dont know anything) with Secrets like dbpassword, dbroot... ? (I hope that the secrets are not supplied via values.yaml override)


Solution

  • The links in the context are outdated

    When you have sub chart, you map them probably as a dependency (look at the condition carefully, that will match with your values.yaml of the same parent chart.), and here is how you pass the sub-charts values.

    Now, I believe you are using this mongodb chart, and in case you want to pass the passwords, you might want to create a k8s secret object and pass the name here.

    Now let's say, There is a chart A and MongoDB is a sub chart of the chart A, if you add MongoDB as a dependency like this, you can put the configuration/values of chart MongoDB, in A values, just like this.

    Now, for the secrets, there is mentioned in the values.yaml of MongoDB, you can create a custom secret and pass the name of the same there, if still not satisfied, you might want to pass the env vars directly to the MongoDB charts values.

    and most importantly, when you defining any chart as dependency or sub chart, you would know which chart it is and what are the values it takes, you can nest the same values in the parent chart.

    When you have more time you can spend some here :)