<p>i'm doing some exercises and trying to wrap my head around how to write yaml build.</p>

<pre><code>    spec:
  containers:
  - image: nginx
    imagePullPolicy: IfNotPresent
    name: nginx
    resources: {}
    envFrom: 
    - configMapRef: 
        name: anotherone # the name of the config map
  dnsPolicy: ClusterFirst
  restartPolicy: Never
status: {}
</code></pre>

<p>VS </p>

<pre><code>containers:
  - image: nginx
    imagePullPolicy: IfNotPresent
    name: nginx
    resources: {}
    env:
    - name: option # name of the env variable
      valueFrom:
        configMapKeyRef:
          name: options # name of config map
          key: var5 # name of the entity in config map
</code></pre>

<p>So my problem here is: When do i use '-' symbol when i make a build in kubernetes ? 
I do understand that if i apply '-' before a string it makes it an object inside a list, but i don't understand when i need to use a list in a build in kubernetes.</p>

Valentin Bichok
<p>the "-" symbol is because type of field is array of objects, if type of field is string then value comes after ":" symbol. When field is object there is no "-" but list of keys of that object like you see for example in <code>valueFrom</code> . You will see sepcification of fields when you run <code>kubectl explain</code>command, for instance:</p>

<pre><code> kubectl explain pod
 kubectl explain pod.spec.containers
</code></pre>
