<p>Friends</p>
<p>Im writing a configMap containing an array of postgres db names. Approach 1 throws an error like
scalar value is expected at postgres.db.name</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-init
data:
  postgres.host: &quot;postgreshost&quot;
  postgres.db.name: {&quot;postgredb1&quot;,&quot;postgredb1&quot;, &quot;postgredb3&quot;}
</code></pre>
<p>Here is Approach 2 ie postgres.db.name having db names separated by comma</p>
<pre><code>----
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-init
data:
  postgres.host: postgreshost
  postgres.db.name: postgredb1,postgredb1,postgredb3
</code></pre>
<p>Which is the correct way to achieve db names as an array ?</p>

<p>Edit: As @ShawnFumo and @HuBeZa pointed out, my old answer was incorrect. Configmap data key/value pairs expect the value to be in string format, therefore it isn't possible to provide a dict/list as value.</p>
<p>note: you have 4 &quot;-&quot; at the start of your second example, which would make the YAML document invalid. new YAML docs start with 3 &quot;-&quot;. :)</p>
<pre><code>---
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-init
data:
  postgres.host: postgreshost
  # Note the &quot;|&quot; after the key - this indicates a multiline string in YAML, 
  # hence we provide the values as strings.
  postgres.db.name: |
    - postgredb1
    - postgredb2
    - postgredb3
</code></pre>
