<p>I have a Helm chart with <code>values.yaml</code> containing:</p>
<pre class="lang-yaml prettyprint-override"><code># Elided
tolerations: []
</code></pre>
<p>I'm trying to pass the tolerations via the command line but it always removes the quotes (or adds double quotes inside single quotes) despite all the below attempts. As a result it <strong>fails</strong> on install saying it expected a string.</p>
<pre class="lang-sh prettyprint-override"><code># Attempt 0
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set tolerations[0].value=&quot;true&quot; --set tolerations[0].operator=Equal --set tolerations[0].effect=NoExecute

# Attempt 1
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set &quot;tolerations[0].value=&quot;true&quot;&quot; --set tolerations[0].operator=Equal --set tolerations[0].effect=NoExecute

# Attempt 2
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set &quot;tolerations[0].value=\&quot;true\&quot;&quot; --set tolerations[0].operator=Equal --set tolerations[0].effect=NoExecute

# Attempt 3
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set tolerations[0].value=&quot;\&quot;true\&quot;&quot; --set tolerations[0].operator=Equal --set tolerations[0].effect=NoExecute

# Attempt 4
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set tolerations[0].value='&quot;true&quot;' --set tolerations[0].operator=Equal --set tolerations[0].effect=NoExecute
</code></pre>
<p>They all end up creating a yaml with <code>value: true</code> or <code>value: '&quot;true&quot;'</code>, neither of which will install.</p>

<p>There appears to be two answers: the exceptionally verbose one that you're trying has a solution, or the more succinct one which doesn't prompt stack overflow questions for future readers to understand:</p>
<p>Helm offers <a href="https://helm.sh/docs/helm/helm_install/#synopsis" rel="noreferrer"><code>--set-string</code></a> which is the interpolation-free version of <code>--set</code></p>
<pre class="lang-sh prettyprint-override"><code>helm install traefik traefik/traefik \
    --set tolerations[0].key=CriticalAddonsOnly \
    --set-string tolerations[0].value=true \
    --set tolerations[0].operator=Equal \
    --set tolerations[0].effect=NoExecute
</code></pre>
<p>However, as you experienced, that <code>--set</code> syntax is designed for the simplest cases only, for more complex cases <code>--values</code> is the correct mechanism. You can read them from stdin if created a temporary yaml file is too much work</p>
<pre class="lang-sh prettyprint-override"><code>printf 'tolerations: [{key: CriticalAddonsOnly, value: &quot;true&quot;, operator: Equal, effect: NoExecute}]\n' | \
  helm install traefik traefik/traefik --values /dev/stdin
</code></pre>
