<p>I want to pass a certificate to the helm chart and currently I am passing using --set-file global.dbValues.dbcacertificate=./server.crt but instead i want to pass the file in values file of helm chart.
The Values.yaml file reads</p>

<pre><code>global:
  dbValues:
    dbcacertificate: &lt;Some Way to pass the .crt file&gt;
</code></pre>

Darshil Shah
<p>According to <a href="https://helm.sh/docs/chart_template_guide/accessing_files/#lines" rel="noreferrer">the relevant documentation</a>, one must pre-process a file that is external to the chart into a means that can be provided via <code>--set</code> or <code>--values</code>, since <code>.Files.Get</code> cannot read file paths that are external to the chart bundle.</p>

<p>So, given the following example template <code>templates/secret.yaml</code> containing:</p>

<pre><code>apiVersion: v1
kind: Secret
data:
  dbcacertificate: {{ .Values.dbcacertificate | b64enc }}
</code></pre>

<p>one can use shell interpolation as:</p>

<pre><code>helm template --set dbcacertificate="$(cat ./server.crt)" .
</code></pre>

<p>or, if shell interpolation is not suitable for your circumstances, you can pre-process the certificate into a yaml compatible format and feed it in via <code>--values</code>:</p>

<pre class="lang-shell prettyprint-override"><code>$ { echo "dbcacertificate: |"; sed -e 's/^/    /' server.crt; } &gt; ca-cert.yaml
$ helm template --values ./ca-cert.yaml .
</code></pre>
