<p>I would like to delete a pod that was created while editing and testing deployment.</p>
<p>I am extracting the pod configuration with</p>
<p><code>kubectl get po jenkins-774896bc77-tc8cg -n infrastructure -o yaml --export=true &gt; a.yaml</code></p>
<p>Then I am editing the <code>a.yaml</code> file and replacing <code>restartPolicy</code> to <code>Never</code>.</p>
<p>Then I tried to run <code>kubectl replace -f ./a.yaml -n infrastructure</code> and <code>kubectl apply -f ./a.yaml -n infrastructure</code></p>
<p>But in both cases I am getting:</p>
<p><code>error: error when replacing &quot;./a.yaml&quot;: resource name may not be empty</code></p>
<p>Any advice how to fix this?</p>

Bob
<p>You have to do this for deployment as deployment manages pods.</p>
<pre><code>kubectl get deployment &lt;your_deployment_name&gt; -o yaml &gt; a.yaml
</code></pre>
<p>and then do the rest part as you did <code>kubectl replace -f ./a.yaml -n infrastructure</code></p>
