<p>I am deploying plain pod yaml file. Attached is the snapshot of Pod.</p>
<p>My requirement is I want to update entire pod whenever its required.
This can be achieved by using kubectl replace command with force, it will take care of deleting and re-creating it.</p>
<p>Command is <code>kubectl replace -f pod.yaml --force</code>.</p>
<p>The RestAPI for replace is PUT (https://kubernetes-url/api/v1/namespaces/default/pods/test-pod)
What query parameter I need to pass to achieve force replace through rest api similar to kubectl force replace.
<a href="https://i.stack.imgur.com/C0hWq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C0hWq.png" alt="enter image description here" /></a></p>

Jayashree Madanala
<p>When you use <code>--force</code> internally it deletes the pod and create it again. <code>PUT</code> verb is not used in this case and there is no parameter for force in the REST API. You need to make two REST API call</p>
<ol>
<li><p>First with <code>DELETE</code> verb to <code>https://kubernetes-url/api/v1/namespaces/default/pods/test-pod</code></p>
</li>
<li><p>Second with <code>POST</code> verb to <code>https://kubernetes-url/api/v1/namespaces/default/pods/test-pod</code></p>
</li>
</ol>
<p>You can verify what REST API call is being made by running the command in verbose mode.</p>
<pre><code>kubectl replace -f pod.yaml --force --v=8
</code></pre>
