<p>I want to set a boolean variable in configMap (or secret):</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: env-config
  namespace: mlo-stage
data:
  webpack_dev_server: false
</code></pre>
<p>But when I apply it, I get the following error:</p>
<pre><code>The request is invalid: patch: Invalid value: &quot;map[data:map[webpack_dev_server:false] metadata:map[annotations:map[kubectl.kubernetes.io/last-applied-configuration:{ blah blah blah}]]]&quot;: unrecognized type: string
</code></pre>
<p>I have tried to change the value to Off/No/False, all having the same problem.</p>
<p>It seems that the value of the keys in the data map can only be string, I have tried to change the value to &quot;false&quot;, the yaml file is OK, but then the variable becomes a string but not boolean.</p>
<p>what should I do if I want to pass a boolean as value?</p>

Ken Tsoi
<p>Values in a <a href="https://kubernetes.io/docs/concepts/configuration/configmap/" rel="noreferrer">ConfigMap</a> must be key-value string values or files.</p>
<p>Change:</p>
<pre><code>data:
  webpack_dev_server: false
</code></pre>
<p>To:</p>
<pre><code>data:
  webpack_dev_server: &quot;false&quot;
</code></pre>
<p>To your question:</p>
<blockquote>
<p>what should I do if I want to pass a boolean as value?</p>
</blockquote>
<p>You may handle this in the application, transform from <code>string</code> to <code>bool</code>.</p>
