<p>kubectl supports <code>--server-dry-run</code> so that modifications are not persisted but changes from admission controllers etc. are applied. The default output looks something like the following:</p>

<pre><code>$ kubectl apply --server-dry-run -f deployment.yaml
deployment.apps/nginx-deployment created (server dry run)
</code></pre>

<p>However, adding <code>-v=8</code> shows me the response body with the actual JSON content that will be persisted to etcd. Is there any way to ask kubectl to print that in a nicer format without some crazy grepping etc.?</p>

dippynark
<p>You can get the appropriate Json by using following command:</p>

<pre><code>kubectl apply --server-dry-run - f deployment.yaml -o json
</code></pre>
