Setting caBundle in MutatingWebhookConfiguration with Helm chart Setting caBundle in MutatingWebhookConfiguration with Helm chart kubernetes kubernetes

Setting caBundle in MutatingWebhookConfiguration with Helm chart


Reading variable dirctly from env variable in your helm chart is not possible due to security reasons and this functionality was not implemented as states in this document.

In helm chart you can always create a variable e.g. myCAbundleVariable in values.yaml file that will be holding your PEM encoded CA and then use value from this variable in chart like this:

webhooks:  - ...    clientConfig:      caBundle: {{ .myCAbundleVariable }}

If you want to pass the value 'in runtime' when running helm command you can use --set parameter.

So your helm command would look like this:

helm install ... --set myCAbundleVariable=$(kubectl config view --raw --minify --flatten \-o jsonpath='{.clusters[].cluster.certificate-authority-data}')`

Let me know if it was helpful.