<p>consider the following kubernetes manifest (mymanifest.yml) :</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: firstpod
spec:
  containers:
  - image: nginx
    name: nginx
---
apiVersion: v1
kind: Pod
metadata:
  name: secondpod
spec:
  containers:
  - image: nginx
    name: nginx
</code></pre>
<p>If I do <code>kubectl apply -f mymanifest.yml</code> both pods are deployed.
I remember someone told me that it is possible to deploy only one pod. Something like :</p>
<pre><code>kubectl apply -f mymanifest.yml secondpod
</code></pre>
<p>But it doesn't work.
Is there a way to do it?</p>
<p>Thx in advance</p>

Abdelghani
<p>You can add labels to the pods</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: firstpod
  labels:
    app: firstpod
spec:
  containers:
  - image: nginx
    name: nginx
---
apiVersion: v1
kind: Pod
metadata:
  name: secondpod
  labels:
    app: secondpod
spec:
  containers:
  - image: nginx
    name: nginx
</code></pre>
<p>Use specific label to filter while applying the yaml. The filter supports <code>=</code>, <code>==</code>, and <code>!=</code></p>
<pre><code>kubectl apply -f mymanifest.yml -l app=secondpod
</code></pre>
<p>You can also use <code>--prune</code> which is an alpha feature.</p>
<pre><code># Apply the configuration in manifest.yaml that matches label app=secondpod and delete all the other resources that are
not in the file and match label app=secondpod.
kubectl apply --prune -f mymanifest.yml -l app=secondpod
</code></pre>
