<p>I'm newbie with K8s and trying to create multiple Pods using a <strong>.yml</strong> file:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
    name: pod-test1
    labels:
        app: frontend
        env: dev
spec:
    containers:
    -   name: container1
        image: nginx:alpine

apiVersion: v1
kind: Pod
metadata:
    name: pod-test2
    labels:
        app: backend
        env: dev
spec:
    containers:
    -   name: container2
        image: nginx:alpine
</code></pre>

<p>But executing <code>kubectl apply -f label.yml</code>, is creating just the second Pod:
<a href="https://i.stack.imgur.com/EmWSQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EmWSQ.png" alt="enter image description here"></a></p>

<p>Could someone give a hint of why this is happening, and if is possible a brief explanation, please?</p>

<p>Thanks a lot, best regards.</p>

<p>use <code>---</code> as seperator between two resources in yaml file like following </p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
    name: pod-test1
    labels:
        app: frontend
        env: dev
spec:
    containers:
    -   name: container1
        image: nginx:alpine
---
apiVersion: v1
kind: Pod
metadata:
    name: pod-test2
    labels:
        app: backend
        env: dev
spec:
    containers:
    -   name: container2
        image: nginx:alpine
</code></pre>
