<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RKE2 Archives - Hécate Regnier - Neurozone</title>
	<atom:link href="https://hecate.neurozone.fr/tag/rke2/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>DBA, DevOps &#38; Sysadmin</description>
	<lastBuildDate>Fri, 27 Nov 2026 09:51:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://hecate.neurozone.fr/wp-content/uploads/2026/10/cropped-avatar_Instagram-150x150.webp</url>
	<title>RKE2 Archives - Hécate Regnier - Neurozone</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">258172890</site>	<item>
		<title>dnf-automatic upgraded my Kubernetes: why cluster packages must be excluded from unattended updates</title>
		<link>https://hecate.neurozone.fr/2026/12/05/dnf-automatic-upgraded-my-kubernetes-why-cluster-packages-must-be-excluded-from-unattended-updates/</link>
					<comments>https://hecate.neurozone.fr/2026/12/05/dnf-automatic-upgraded-my-kubernetes-why-cluster-packages-must-be-excluded-from-unattended-updates/#respond</comments>
		
		<dc:creator><![CDATA[Hécate Regnier]]></dc:creator>
		<pubDate>Sat, 05 Dec 2026 14:00:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sysadmin notebook]]></category>
		<category><![CDATA[Ansible]]></category>
		<category><![CDATA[dnf-automatic]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[etcd]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[RKE2]]></category>
		<category><![CDATA[sysadmin notebook]]></category>
		<guid isPermaLink="false">https://hecate.neurozone.fr/?p=4648</guid>

					<description><![CDATA[<p>One Monday morning, looking at my small Kubernetes cluster&#8217;s state for an entirely different reason, I notice a detail in the version column. I had installed RKE2 as v1.36.6+rke2r1 four days earlier. All three nodes showed rke2r2, including the third, which failed at 13:28 that day for an unrelated hardware reason. Nobody had upgraded the...</p>
<p>The post <a href="https://hecate.neurozone.fr/2026/12/05/dnf-automatic-upgraded-my-kubernetes-why-cluster-packages-must-be-excluded-from-unattended-updates/">dnf-automatic upgraded my Kubernetes: why cluster packages must be excluded from unattended updates</a> appeared first on <a href="https://hecate.neurozone.fr">Hécate Regnier - Neurozone</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">One Monday morning, looking at my small Kubernetes cluster&#8217;s state for an entirely different reason, I notice a detail in the version column. I had installed RKE2 as <code>v1.36.6+rke2r1</code> four days earlier. All three nodes showed <code>rke2r2</code>, including the third, which failed at 13:28 that day for an unrelated hardware reason. Nobody had upgraded the cluster, and yet it had been upgraded, overnight, without draining nodes, without an etcd snapshot and without my knowing.</p>



<pre class="wp-block-code"><code>$ kubectl get nodes
NAME     STATUS   ROLES                AGE     VERSION
node-a   Ready    control-plane,etcd   5d17h   v1.36.6+rke2r2
node-b   Ready    etcd                 5d17h   v1.36.6+rke2r2
node-c   NotReady control-plane,etcd   5d20h   v1.36.6+rke2r2</code></pre>



<p class="wp-block-paragraph">The culprit is a tool I&#8217;ve used for years on all my machines and gladly recommend: dnf-automatic. The story isn&#8217;t that it did its job badly. It did it exactly as designed, and that&#8217;s precisely the problem.</p>



<h3 class="wp-block-heading">What dnf-automatic did, minute by minute</h3>



<p class="wp-block-paragraph">The RPM transaction log leaves no doubt. <code>/var/log/dnf.rpm.log</code> keeps every install and upgrade, with the time. RKE2 was installed on 20 November as revision r1, then replaced on the 24th at 06:28 by revision r2.</p>



<pre class="wp-block-code"><code>$ grep rke2 /var/log/dnf.rpm.log
2026-11-20T16:13:15+0100 SUBDEBUG Installed: rke2-server-1.36.6~rke2r1-0.el10.x86_64
2026-11-24T06:28:09+0100 SUBDEBUG Upgrade: rke2-server-1.36.6~rke2r2-0.el10.x86_64
2026-11-24T06:28:09+0100 SUBDEBUG Upgraded: rke2-server-1.36.6~rke2r1-0.el10.x86_64</code></pre>



<p class="wp-block-paragraph">RKE2 ships as RPM packages for Red Hat family distributions, from a Rancher repository. That repository follows a version branch, 1.36 here, and publishes fixes as they come. When Rancher released revision r2, a rebuild of the same Kubernetes version with updated components, the repository offered it like any other update. And dnf-automatic, configured to install everything, installed it.</p>



<pre class="wp-block-code"><code># /etc/dnf/automatic.conf (excerpt)
[commands]
upgrade_type = default     # every update, not only security ones
random_sleep = 360         # up to 6 minutes of random delay per machine
download_updates = yes
apply_updates = yes        # install, not just download
reboot = never</code></pre>



<p class="wp-block-paragraph">Every setting matters. <code>upgrade_type = default</code> installs every available update, not only those fixing security issues, which the <code>security</code> value would do. <code>apply_updates = yes</code> actually installs, instead of just downloading. <code>random_sleep</code> adds a random delay, up to six minutes here, so all machines don&#8217;t hit the mirrors at the same second. And the <code>[base]</code> section accepts an <code>exclude</code> line: I had already listed Wazuh and MariaDB there, two programs I upgrade by hand, but not RKE2, which I had just installed.</p>



<h3 class="wp-block-heading">The package restarts its own service</h3>



<p class="wp-block-paragraph">Upgrading a package doesn&#8217;t necessarily restart the service. Many daemons keep running the old binary until the next restart. So I wanted to know whether the control plane had really restarted, or only the files on disk had changed. The scripts embedded in an RPM are read with <code>rpm -q --scripts</code>.</p>



<pre class="wp-block-code"><code>$ rpm -q --scripts rke2-server | sed -n &#x27;/postuninstall/,$p&#x27;
postuninstall scriptlet (using /bin/sh):
if [ $1 -ge 1 ] &amp;&amp; [ -x &quot;/usr/lib/systemd/systemd-update-helper&quot; ]; then
    # Package upgrade, not uninstall
    /usr/lib/systemd/systemd-update-helper mark-restart-system-units rke2-server.service || :
fi</code></pre>



<p class="wp-block-paragraph">The script run after the upgrade marks <code>rke2-server.service</code> for a restart. <code>systemd-update-helper</code> is Fedora and Red Hat&#8217;s tool that collects those requests and runs them at the end of the transaction. In other words, it&#8217;s intended: the package makes sure the new version runs. The system log confirms what followed.</p>



<pre class="wp-block-code"><code>Nov 24 06:28:09 rpm[935752]: upgrade: rke2-server-1.36.6~rke2r2 (from: rke2-server-1.36.6~rke2r1): success
Nov 24 06:28:11 systemd[1]: Stopping rke2-server.service - Rancher Kubernetes Engine v2 (server)...
Nov 24 06:28:11 systemd[1]: rke2-server.service: Unit process 9417 (containerd-shim) remains running after unit stopped.
Nov 24 06:28:11 systemd[1]: Starting rke2-server.service - Rancher Kubernetes Engine v2 (server)...
Nov 24 06:31:55 systemd[1]: Started rke2-server.service - Rancher Kubernetes Engine v2 (server).</code></pre>



<p class="wp-block-paragraph">The service stopped at 06:28:11 and was only ready again at 06:31:55, almost four minutes. The <em>remains running after unit stopped</em> lines are normal for RKE2: the <code>containerd-shim</code> processes carrying the containers survive the service stop, so applications weren&#8217;t killed. But for those four minutes, the Kubernetes API and that machine&#8217;s etcd member were gone. Eleven minutes later, at 06:39, the second machine did the same. The third did too, necessarily, since it reports version r2 itself; but it was powered off when I investigated, and I don&#8217;t know when it restarted.</p>



<h3 class="wp-block-heading">Why it&#8217;s dangerous, even when all goes well</h3>



<p class="wp-block-paragraph">This time there was no damage. Revision r2 was a simple fix, every node came back, and the Kubernetes API answered when I looked. I know the two restarts I can date didn&#8217;t overlap; for the third, I don&#8217;t know. That&#8217;s exactly what worries me. My cluster has three etcd members. etcd works as long as a majority answers, two out of three here. If two machines draw close random delays, two members are gone at once, etcd loses quorum, and the Kubernetes API stops answering until one comes back. If it didn&#8217;t happen, chance protected me, not design.</p>



<figure class="wp-block-image size-full"><a href="https://hecate.neurozone.fr/wp-content/uploads/2026/11/x03_unattended_night_en.png"><img decoding="async" src="https://hecate.neurozone.fr/wp-content/uploads/2026/11/x03_unattended_night_en.png" alt="Timeline from 06:20 to 06:45: the first node down from 06:28:11 to 06:31:55, the second at 06:39, the third moved to r2 at an unknown time" class="wp-image-4651"/></a><figcaption class="wp-element-caption">The dated restarts don&#8217;t overlap, but nothing in the configuration prevented it.</figcaption></figure>



<p class="wp-block-paragraph">There&#8217;s also what a deliberate upgrade would have done and this one didn&#8217;t. RKE2&#8217;s procedure recommends upgrading one node at a time, servers first, taking an etcd snapshot beforehand, and draining the node to move its workloads. None of that happened. And the next update could be a minor version with removed APIs, or one requiring a specific order between servers and agents. A tool that installs whatever the repository offers knows nothing of those constraints.</p>



<p class="wp-block-paragraph">Finally, my Ansible role declared <code>rke2_version: 1.36.6~rke2r1</code>. It only enforced that version at install time, with <code>state: present</code>, and never went back. Code and reality diverged without any signal: the source of truth was lying.</p>



<h3 class="wp-block-heading">The fix: exclude in the repository, install knowingly</h3>



<p class="wp-block-paragraph">Several options exist. You can add <code>rke2-*</code> to dnf-automatic&#8217;s <code>exclude</code> line, but that only protects against dnf-automatic: a manual <code>dnf upgrade</code> run for something else would take RKE2 along. You can use dnf&#8217;s <code>versionlock</code> plugin, which pins an exact version, but then you have to unlock and relock it for every deliberate upgrade. I chose to put the exclusion on Rancher&#8217;s repositories themselves: for dnf, and so for dnf-automatic as for me, RKE2 packages no longer exist. Only the Ansible role sees them, thanks to <code>disable_excludes: all</code> in the install task.</p>



<pre class="wp-block-code"><code># roles/rke2/tasks/main.yml (excerpt): the repositories hide rke2-* from dnf
- name: RKE2 repositories
  ansible.builtin.yum_repository:
    name: &quot;{{ item.name }}&quot;
    description: &quot;{{ item.desc }}&quot;
    baseurl: &quot;{{ item.url }}&quot;
    gpgcheck: true
    enabled: true
    # dnf-automatic upgraded rke2-server r1 -&gt; r2 by itself and restarted the
    # control plane. RKE2 only moves through rke2_version and this role.
    exclude: &quot;rke2-*&quot;
  loop: &quot;{{ rke2_repos }}&quot;

# ...and the role itself is the only thing allowed to look past the exclude
- name: Install RKE2
  ansible.builtin.dnf:
    name: &quot;rke2-{{ rke2_role }}-{{ rke2_version }}&quot;
    state: present
    disable_excludes: all</code></pre>



<p class="wp-block-paragraph">This split has one advantage: RKE2 only moves when I change <code>rke2_version</code> and run the role. The version written in the Ansible repository becomes the truth again. I also aligned that variable with what actually runs, r2, since going back would have gained nothing.</p>



<figure class="wp-block-image size-full"><a href="https://hecate.neurozone.fr/wp-content/uploads/2026/11/x03_single_gate_en.png"><img decoding="async" src="https://hecate.neurozone.fr/wp-content/uploads/2026/11/x03_single_gate_en.png" alt="dnf-automatic and a manual dnf upgrade go through the rancher-rke2 repositories, which exclude rke2-*, and find no package; only the Ansible role, with disable_excludes all, installs the chosen version, node by node" class="wp-image-4649"/></a><figcaption class="wp-element-caption">RKE2 packages no longer exist for dnf; only the Ansible role sees them.</figcaption></figure>



<h3 class="wp-block-heading">The verification</h3>



<p class="wp-block-paragraph">An exclusion is tested by asking dnf the question dnf-automatic would ask. Without options, <code>repoquery</code> finds no <code>rke2-server</code> package, and <code>check-update</code> returns 0, meaning nothing to update there. With <code>--disableexcludes=all</code>, the three published versions reappear: the repository works, it&#8217;s only hidden.</p>



<pre class="wp-block-code"><code># the packages are invisible to dnf, so to dnf-automatic too
$ dnf -q repoquery rke2-server
$ dnf -q check-update rke2-server; echo rc=$?
rc=0                                  # 0 = nothing to update
# ...but still there for whoever asks explicitly
$ dnf -q repoquery --disableexcludes=all rke2-server
rke2-server-0:1.36.5~rke2r1-0.el10.x86_64
rke2-server-0:1.36.6~rke2r1-0.el10.x86_64
rke2-server-0:1.36.6~rke2r2-0.el10.x86_64</code></pre>



<p class="wp-block-paragraph">The role was applied to the two running nodes; the third, down with a hardware fault at the time, will get it before rejoining the cluster. The next morning dnf-automatic ran as usual on both machines: a new kernel on one, Grafana and rsync on the other, and no RKE2 line in <code>dnf.rpm.log</code>. That second observation proves little as long as Rancher hasn&#8217;t released a new revision; the real proof is the query above, which shows dnf no longer sees the packages.</p>



<h3 class="wp-block-heading">And the next upgrade</h3>



<p class="wp-block-paragraph">A deliberate upgrade becomes a separate operation, done in daytime and node by node. Drain the node, take an etcd snapshot, run the role with the new version, wait for the node to come back with the right version, then put it back in service before moving to the next.</p>



<pre class="wp-block-code"><code># a deliberate upgrade, one node at a time
kubectl drain node-a --ignore-daemonsets --delete-emptydir-data
rke2 etcd-snapshot save --name pre-upgrade-$(date +%Y%m%d)
ansible-playbook site.yml -l node-a --tags rke2 -e rke2_version=1.36.7~rke2r1
kubectl get node node-a -o wide        # wait for Ready and the new version
kubectl uncordon node-a</code></pre>



<h3 class="wp-block-heading">What I take away</h3>



<p class="wp-block-paragraph">Automatic updates remain good practice for the vast majority of packages: the TLS library, the SSH server, the kernel that will load at the next reboot. They become dangerous for software forming a distributed system, where each machine depends on the others&#8217; state, and for software whose package restarts the service itself. Kubernetes, etcd, a replicated database, a storage cluster: anything with a quorum or an upgrade order deserves an explicit exclusion.</p>



<p class="wp-block-paragraph">The reflex to keep, every time you add software to a machine that updates itself, is one question: if this package is replaced at 06:00 with nobody watching, what happens? For RKE2, the answer was a control plane restarted three times unattended. The answer is now: nothing.</p>
<p>The post <a href="https://hecate.neurozone.fr/2026/12/05/dnf-automatic-upgraded-my-kubernetes-why-cluster-packages-must-be-excluded-from-unattended-updates/">dnf-automatic upgraded my Kubernetes: why cluster packages must be excluded from unattended updates</a> appeared first on <a href="https://hecate.neurozone.fr">Hécate Regnier - Neurozone</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hecate.neurozone.fr/2026/12/05/dnf-automatic-upgraded-my-kubernetes-why-cluster-packages-must-be-excluded-from-unattended-updates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4648</post-id>	</item>
	</channel>
</rss>
