<p>In the kubectl Cheat Sheet (<a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/" rel="noreferrer">https://kubernetes.io/docs/reference/kubectl/cheatsheet/</a>), there are 3 ways to modify resources. You can either update, patch or edit.</p>

<p>What are the actual differences between them and when should I use each of them?</p>

Doomro
<p>I would like to add a few things to <em>night-gold's</em> answer. I would say that there are no better and worse ways of modifying your resources. <strong>Everything depends on particular situation and your needs.</strong></p>

<p>It's worth to emphasize <strong>the main difference between editing and patching</strong> namely the first one is an <strong>interactive method</strong> and the second one we can call <strong>batch method</strong> which unlike the first one may be easily used in scripts. Just imagine that you need to make change in dozens or even a few hundreds of different <strong>kubernetes resources/objects</strong> and it is much easier to write a simple script in which you can <strong>patch</strong> all those resources in an automated way. Opening each of them for editing wouldn't be very convenient and effective. Just a short example:</p>

<pre><code>kubectl patch resource-type resource-name --type json -p '[{"op": "remove", "path": "/spec/someSection/someKey"}]'
</code></pre>

<p>Although at first it may look unnecessary complicated and not very convenient to use in comparison with interactive editing and manually removing specific line from specific section, in fact it is a very quick and effective method which may be easily implemented in scripts and can save you a lot of work and time when you work with many objects.</p>

<p>As to <code>apply</code> command, you can read in the <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#apply" rel="nofollow noreferrer">documentation</a>:</p>

<blockquote>
  <p>apply manages applications through files defining Kubernetes
  resources. It creates and updates resources in a cluster through
  running kubectl apply. <strong>This is the recommended way of managing
  Kubernetes applications on production.</strong></p>
</blockquote>

<p>It also gives you possibility of modifying your running configuration by re-applying it from updated <code>yaml</code> manifest e.g. pulled from git repository.</p>

<p>If by <code>update</code> you mean <code>rollout</code> ( formerly known as rolling-update ), as you can see in <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#updating-resources" rel="nofollow noreferrer">documentation</a> it has quite different function. It is mostly used for updating deployments. You don't use it for making changes in arbitrary type of resource.</p>
