<p><code>List</code> API objects and triple dashes (<code>---</code>) can both be used to denote multiple objects in a single YAML file. Therefore, why do Lists exist when triple dashes accomplish the same thing (in my opinion) in a cleaner way? Are there any cases in which a List would be preferred over triple dashes, or is this purely a stylistic choice?</p>

<p>For example, these two YAML files both produce the same two <code>ServiceAccount</code> objects (chosen for brevity):</p>

<p>my-serviceaccounts1.yaml</p>

<pre><code>apiVersion: v1
kind: List
metadata: {}
items:
- apiVersion: v1
  kind: ServiceAccount
  metadata:
    name: my-app
- apiVersion: v1
  kind: ServiceAccount
  metadata:
    name: my-other-app
</code></pre>

<p>my-serviceaccounts2.yaml</p>

<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-app
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-other-app
</code></pre>

<p>I can think of two reasons:</p>

<ol>
<li>Because the Kubernetes API works with JSON and in JSON there is no ---</li>
<li>Maybe the kind List is meant only for responses.</li>
</ol>
