<p>I was playing around in minikube and installed the wrong version of istio.  I ran:</p>

<pre><code>kubectl apply -f install/kubernetes/istio-demo-auth.yaml
</code></pre>

<p>instead of:</p>

<pre><code>kubectl apply -f install/kubernetes/istio-demo.yaml
</code></pre>

<p>I figured I would just undo it and install the right one.</p>

<p>But I cannot seem to find an <code>unapply</code> command.</p>

<p><strong>How do I <em>undo</em> a "kubectl apply" command?</strong></p>

<p>One way would be <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#delete" rel="noreferrer"><code>kubectl delete -f &lt;filename&gt;</code></a> but it implies few things:</p>

<ol>
<li><p>The resources were first created. It simply removes all of those, if you really want to "revert to the previous state" I'm not sure there are built-in tools in Kubernetes to do that (so you really would restore from a backup, if you have one)</p></li>
<li><p>The containers did not modify the host machines: containers may mount root filesystem and change it, or kernel subsystems (iptables, etc). The <code>delete</code> command would not revert it either, and in that case you really need to check the documentation for the product to see if they offer any official way to guarantees a proper cleanup</p></li>
</ol>
