<p>Dears,</p>
<p>I am very new to Kubernetes and I'm currently working on the update process of my services (traefik, prometheus, ...). I want to avoid the compulsive real-time updates that may lead to bugs or crash. I am used to keep the control about what need to be updated and what does not.</p>
<p>So far, I understood that Kubernetes provides the field <code>spec.updateStrategy.type</code> with 2 possible values:</p>
<ul>
<li><code>RollingUpdate</code>: permanent auto-update</li>
<li><code>OnDelete</code>: auto-update after the manual deletion of a pod</li>
</ul>
<p>I am surprised to not find the same steps than with <code>apt</code> Debian tool: when I use <code>apt update; apt upgrade</code>, I get a list of what will be updated and I choose what I want to be updated.</p>
<p>When I came to Kubernetes, I imagined updates would allow to keep this two-steps spirit, something like :</p>
<ol>
<li>Execute a command to compare the current docker images that are deployed on the cluster to the repos. This command would print the new existing version of each images.</li>
<li>Execute another command to choose what will be updated.</li>
</ol>
<p>There is no <code>stable</code>, <code>unstable</code>, <code>testing</code> channels like Linux repositories with docker, then I have no way to make difference between the testing update and the trustworthy updates. I am affraid that <code>RollingUpdate</code> would deploy each new image without distinction.</p>
<p>Which lead to my main question: is it completely safe to blindly trust <code>RollingUpdate</code> ?</p>

n0n0bstan
<p>It is safe to trust the <code>RollingUpdate</code> <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies" rel="nofollow noreferrer">StatefulSet update strategy</a>.  However, it is important to note that this is <em>not</em> an &quot;auto-update&quot;.</p>
<p>A StatefulSet (and also a Deployment) has a template Pod spec that has an <code>image:</code>.  That tends to name a fairly specific version of the image to run.  In general Kubernetes will check to see if an image with that name and tag is already on the node, and if so, tries to run it without updating it (see <a href="https://kubernetes.io/docs/concepts/containers/images/#updating-images" rel="nofollow noreferrer">Updating images</a>, which discusses the <code>imagePullPolicy:</code> field).</p>
<p>So if your StatefulSet says <code>image: prom/prometheus:2.26.0</code>, for example, your Pods will use <em>exactly</em> that version of Prometheus, and no other.  If you just say <code>image: prom/prometheus</code> with no tag (or with <code>...:latest</code>) then each node will pull whatever version happens to be current at the time the Pod starts up, and you can easily wind up with out-of-sync versions.</p>
<p>The place the update strategy gets used, then, is when you change <code>image: prom/prometheus:2.27.0</code>.  The image in a Pod spec can't be modified, so the existing pods need to be deleted and recreated.  If you have <code>updateStrategy: { type: RollingUpdate }</code> (the default) then the StatefulSet controller will do this for you, specifically deleting and recreating the pods in order.  If you have it set to <code>OnDelete</code> then you need to manually delete the pods.</p>
<p>Since you as the administrator control the <code>image:</code> then you can pick exactly what version is getting used; there is no such thing as a &quot;stable update channel&quot; that will automatically update.  Correspondingly, you can deploy the updated StatefulSet YAML configuration in a pre-production environment to test out before you promote it to production.</p>
