<p>i have a docker-composes for app dotnetcore, I'm new to k8s, my app has quite a long envvariable. &quot;ConnectionStrings__DefaultConnection&quot; as below</p>
<pre><code>      productstudio:
    volumes:
      - ${USERPROFILE}/.aws:/root/.aws
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ConnectionStrings__DefaultConnection=Username=someuser;Password=somepassword;Server=postgres;Port=5432;Database=somedb;Search Path=some
      - EventBus__Enable=true
      - EventBus__HostUri=rabbitmq://eventbus/
</code></pre>
<p>and i write configmap</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: be-productstudio-configmap
  labels:
    app: product-builder-be
    tier: backend
data:
  ASPNETCORE_ENVIRONMENT: Development
  EventBus__Enable: true
  EventBus__HostUri: rabbitmq://eventbus/
  ConnectionStrings__DefaultConnection: |-
    Username=someuser;
    Password=somepassword;
    Server=postgres;
    Port=5432;
    Database=somedb;
    Search Path=some
</code></pre>
<p>But I got an error</p>
<pre><code>Error from server (BadRequest): error when creating &quot;manifect-be.yml&quot;: ConfigMap in version &quot;v1&quot; cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects &quot; or n, but found t, error found in #10 byte of ...|_Enable&quot;:true,&quot;Event|..., bigger context ...|nSearch Path=productstudio\&quot;&quot;,&quot;EventBus__Enable&quot;:true,&quot;EventBus__HostUri&quot;:&quot;rabbitmq://eventbus/&quot;},&quot;k|...
</code></pre>
<p>Can anyone help me, thanks</p>

Quân nguyễn
<p>I see two issues here:</p>
<ol>
<li>The error you see means that the value <code>true</code> for <code>EventBus__Enable</code> is not quoted and it gets treated as a keyword that means a boolean true. Environment variables are strings and must be quoted in your yaml definition. You need to make it look more like this:</li>
</ol>
<hr />
<pre><code>  EventBus__Enable: &quot;true&quot;
</code></pre>
<ol start="2">
<li>You should not use spaces in your key definitions of your <code>ConfigMap</code>:</li>
</ol>
<hr />
<pre><code>Search Path=productstudio
</code></pre>
<p>as:</p>
<blockquote>
<p>Each key under the <code>data</code> or the <code>binaryData</code> field must consist of
alphanumeric characters, <code>-</code>, <code>_</code> or <code>.</code>.</p>
</blockquote>
<p>You can use the <a href="https://kubernetes.io/docs/concepts/configuration/configmap/" rel="nofollow noreferrer">official docs</a> for a reference of a correctly configured ConfigMaps, for example:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: game-demo
data:
  # property-like keys; each key maps to a simple value
  player_initial_lives: &quot;3&quot;
  ui_properties_file_name: &quot;user-interface.properties&quot;

  # file-like keys
  game.properties: |
    enemy.types=aliens,monsters
    player.maximum-lives=5
  user-interface.properties: |
    color.good=purple
    color.bad=yellow
    allow.textmode=true
</code></pre>
