<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: david</title>
    <description>The latest articles on DEV Community by david (@dwoitzik).</description>
    <link>https://dev.to/dwoitzik</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3933869%2Ff4f624ad-8109-4085-83e9-0919101a8486.png</url>
      <title>DEV Community: david</title>
      <link>https://dev.to/dwoitzik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dwoitzik"/>
    <language>en</language>
    <item>
      <title>Velero Postgres Backup: Send pg_dump Offsite, Not the Data Directory</title>
      <dc:creator>david</dc:creator>
      <pubDate>Thu, 03 Dec 2026 16:53:41 +0000</pubDate>
      <link>https://dev.to/dwoitzik/velero-postgres-backup-send-pgdump-offsite-not-the-data-directory-14fm</link>
      <guid>https://dev.to/dwoitzik/velero-postgres-backup-send-pgdump-offsite-not-the-data-directory-14fm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/velero-postgres-backup-pg-dump-offsite/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;On 2026-11-12 my R2 budget guard paused the offsite Velero schedule at 9.13 GiB of its 9 GiB cap. I had already shortened the offsite retention once for the same reason, three weeks earlier. This time I measured what one backup actually read: 11 GiB of raw volume data, and 8.8 GiB of that was Postgres data directories, mostly WAL. The databases inside them were 10 to 15 MB each. Worse, a file copy of a running Postgres is not a consistent backup, so all that space bought me no restorable database offsite. The fix: leave the database pods out of the offsite backup and send &lt;code&gt;pg_dump&lt;/code&gt; archives instead, taken by a Velero pre-backup hook and checked with &lt;code&gt;pg_restore --list&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;Velero runs two schedules on my k3s cluster. The local one backs up into Garage, the S3 store inside the cluster. The offsite one, &lt;code&gt;daily-offsite&lt;/code&gt;, runs at 04:00 into Cloudflare R2 with &lt;code&gt;defaultVolumesToFsBackup: true&lt;/code&gt;, so the node agent copies pod volumes with Kopia. It covers four namespaces: &lt;code&gt;apps&lt;/code&gt;, &lt;code&gt;vault&lt;/code&gt;, &lt;code&gt;database&lt;/code&gt; and &lt;code&gt;argocd&lt;/code&gt;. The overall layout is in &lt;a href="https://dev.to/blog/321-backup-velero-pbs-offsite/"&gt;my 3-2-1 backup post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;R2 has no spending cap. A CronJob, &lt;code&gt;r2-usage-guard&lt;/code&gt;, checks stored bytes once a day and pauses &lt;code&gt;daily-offsite&lt;/code&gt; above 9 GiB, under the 10 GiB free tier. In October that guard paused the schedule, the TTL ran out, and the offsite set was gone. The fix then was a 3-day TTL instead of 7. Three weeks later the guard fired again, so a shorter TTL was clearly not the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where 11 GiB per Backup Came From
&lt;/h2&gt;

&lt;p&gt;I listed the &lt;code&gt;PodVolumeBackups&lt;/code&gt; of the last offsite backup, &lt;code&gt;daily-offsite-20261111040018&lt;/code&gt;, with their byte counts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get podvolumebackups -n velero -l velero.io/backup-name=&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;backup&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  -o custom-columns=POD:.spec.pod.name,VOL:.spec.volume,BYTES:.status.progress.totalBytes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;124 pod volumes, 11 GiB read. Grouped:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Raw bytes per backup&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Raw Postgres data directories (5 CNPG &lt;code&gt;pgdata&lt;/code&gt;, &lt;code&gt;immich-postgres&lt;/code&gt; &lt;code&gt;db&lt;/code&gt;, Paperless and Nextcloud Postgres &lt;code&gt;data&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;8.8 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;emptyDir volumes (caches, &lt;code&gt;tmp&lt;/code&gt;, sockets, &lt;code&gt;shm&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;0.43 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Everything else (Nextcloud data and html, vault, redis, small app volumes)&lt;/td&gt;
&lt;td&gt;1.78 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why Postgres Data Directories Are So Big
&lt;/h2&gt;

&lt;p&gt;The data directories are mostly WAL. Each CloudNativePG cluster keeps about 577 MiB of &lt;code&gt;pg_wal&lt;/code&gt; for a database of 10 to 15 MB. Immich's data directory was 2.3 GiB for a 523 MB database.&lt;/p&gt;

&lt;p&gt;WAL segments are rewritten constantly, so Kopia found little to deduplicate from one day to the next. And Velero's Kopia uploader does not compress. In Velero v1.14.1, &lt;code&gt;pkg/uploader/kopia/snapshot.go&lt;/code&gt; sets &lt;code&gt;CompressorName: "none"&lt;/code&gt;. The comment in my own &lt;code&gt;offsite-schedule.yml&lt;/code&gt; said "kopia/zstd". It was wrong, and I had sized the offsite tier around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bigger Problem: No Consistent Database Offsite
&lt;/h2&gt;

&lt;p&gt;Size was the visible symptom. The real problem was that a file-level copy of a running Postgres is not a backup you can rely on. Kopia reads the files one after another while the server keeps writing, so the copy can contain data files and WAL from different points in time.&lt;/p&gt;

&lt;p&gt;CNPG's own barman backups are consistent, but they go to the local Garage bucket. So the offsite tier, the copy meant to survive losing the host, had no restorable database at all. It had 8.8 GiB of something that looked like one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix (ADR-075, #1084)
&lt;/h2&gt;

&lt;p&gt;Three changes to &lt;code&gt;daily-offsite&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Skip emptyDirs with a Velero volume policy.&lt;/strong&gt; Caches, sockets and scratch space get rebuilt when the pod starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;offsite-volume-policy&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;velero&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;policy.yaml&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
    &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
    &lt;span class="na"&gt;volumePolicies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;conditions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;volumeTypes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;emptyDir&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;skip&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Velero 1.14 the volume policy is evaluated for fs-backup pod volumes before the &lt;code&gt;defaultVolumesToFsBackup&lt;/code&gt; fallback, so this works with opt-out backups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Leave the database pods out with a &lt;code&gt;labelSelector&lt;/code&gt;.&lt;/strong&gt; The 1.14 volume policy can match capacity, storage class, NFS or CSI source and volume type. None of those tells a database PVC apart from the rest. A pod excluded from the backup takes its volumes with it, so the Schedule selects around them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0 4 * * *"&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;ttl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;72h0m0s&lt;/span&gt;
    &lt;span class="na"&gt;storageLocation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;r2-offsite&lt;/span&gt;
    &lt;span class="na"&gt;defaultVolumesToFsBackup&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;resourcePolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;configmap&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;offsite-volume-policy&lt;/span&gt;
    &lt;span class="na"&gt;labelSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;matchExpressions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cnpg.io/podRole&lt;/span&gt;
          &lt;span class="na"&gt;operator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NotIn&lt;/span&gt;
          &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cnpg.io/pvcRole&lt;/span&gt;
          &lt;span class="na"&gt;operator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NotIn&lt;/span&gt;
          &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;PG_DATA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;PG_WAL&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app&lt;/span&gt;
          &lt;span class="na"&gt;operator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NotIn&lt;/span&gt;
          &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;immich-postgres&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;postgres-paperless&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;postgres-nextcloud&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only the pods carry those &lt;code&gt;app&lt;/code&gt; labels, so the StatefulSets, Services and PVC manifests are still in the backup. On restore the databases come up empty from Git and get loaded from the dump.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Dump the databases in a pre-backup hook.&lt;/strong&gt; A small &lt;code&gt;pg-dump&lt;/code&gt; Deployment in &lt;code&gt;database&lt;/code&gt; and in &lt;code&gt;apps&lt;/code&gt; idles with a 2Gi &lt;code&gt;local-path&lt;/code&gt; PVC. Velero runs the dump right before it copies that PVC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;      &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;pre.hook.backup.velero.io/container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pg-dump&lt;/span&gt;
        &lt;span class="na"&gt;pre.hook.backup.velero.io/command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'["/bin/sh", "/scripts/pg-dump.sh"]'&lt;/span&gt;
        &lt;span class="na"&gt;pre.hook.backup.velero.io/on-error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Continue&lt;/span&gt;
        &lt;span class="na"&gt;pre.hook.backup.velero.io/timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;15m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The core of the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; name &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$DUMP_TARGETS&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  load &lt;span class="s2"&gt;"$name"&lt;/span&gt;
  &lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$OUT/.$file.dump.partial"&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; pg_dump --host=&lt;span class="s2"&gt;"$host"&lt;/span&gt; --username=&lt;span class="s2"&gt;"$user"&lt;/span&gt; --dbname=&lt;span class="s2"&gt;"$db"&lt;/span&gt; \
      --format=custom --file=&lt;span class="s2"&gt;"$tmp"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pg_restore --list &lt;span class="s2"&gt;"$tmp"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    mv -f &lt;span class="s2"&gt;"$tmp"&lt;/span&gt; &lt;span class="s2"&gt;"$OUT/$file.dump"&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    rm -f &lt;span class="s2"&gt;"$tmp"&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"pg-dump: $file FAILED, previous dump kept"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2
    &lt;span class="nv"&gt;rc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A dump only replaces the previous file once &lt;code&gt;pg_restore --list&lt;/code&gt; can read it. A failed database keeps its last good dump and the hook exits non-zero. I chose &lt;code&gt;on-error: Continue&lt;/code&gt; on purpose: &lt;code&gt;Fail&lt;/code&gt; would skip the &lt;code&gt;pg-dumps&lt;/code&gt; volume completely and lose the dumps that did succeed. The error still marks the backup &lt;code&gt;PartiallyFailed&lt;/code&gt;, and &lt;code&gt;VeleroBackupPartialFailure&lt;/code&gt; alerts on that.&lt;/p&gt;

&lt;p&gt;A hook instead of a CronJob that runs before 04:00 means the dump happens at exactly the time of the backup that copies it, with no clock coupling. The local schedule runs the same hook, so the Garage tier gets consistent dumps too.&lt;/p&gt;

&lt;p&gt;The pod uses the &lt;code&gt;postgres:18.4-alpine&lt;/code&gt; client, the newest server major in use. pg_dump 18 can dump the 16 (immich), 17 (CNPG) and 18 servers, and the archives need pg_restore 18, so restores run from the same pod.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification
&lt;/h2&gt;

&lt;p&gt;The first backups with the new scope read 1.85 GiB with 27 &lt;code&gt;PodVolumeBackups&lt;/code&gt;, down from 11 GiB with 124. Nextcloud data and html are 1.5 GiB of that, the dumps 100 MB. The first backup added 0.24 GiB to R2, a second one minutes later 0.05 GiB. The old raw blobs leave R2 only after the backups that reference them expire and Kopia maintenance has run, so usage drops over days, not at once.&lt;/p&gt;

&lt;p&gt;I only trust a dump I have restored, so I restored two into scratch databases. The first attempt failed on the first statement: pg_restore 18 always emits &lt;code&gt;SET transaction_timeout&lt;/code&gt;, which a Postgres 16 server rejects. Restore mode (#1088) now pipes &lt;code&gt;pg_restore&lt;/code&gt; into &lt;code&gt;psql&lt;/code&gt; without that line, with &lt;code&gt;ON_ERROR_STOP&lt;/code&gt; in a single transaction, so a failed restore leaves the database unchanged:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; -n apps deploy/pg-dump -- sh /scripts/pg-dump.sh restore IMMICH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Immich dump restored into the Immich Postgres 16 image with row counts matching live: 26413 assets, 18518 faces, 42 albums. Synapse restored into the CNPG 17.2 image.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trade-Offs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No point-in-time recovery offsite.&lt;/strong&gt; The offsite restore point is the dump taken at backup time. Local PITR from CNPG's barman backups in Garage still exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restore is no longer "restore the PVC".&lt;/strong&gt; The database comes up empty from Git, then &lt;code&gt;pg_restore&lt;/code&gt; loads the dump. The steps are in my disaster recovery doc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New databases need two edits.&lt;/strong&gt; Add each one to &lt;code&gt;DUMP_TARGETS&lt;/code&gt;, and add each new plain Postgres StatefulSet to the Schedule's &lt;code&gt;labelSelector&lt;/code&gt;. Miss either and it is missing offsite or copied raw again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the second time a Velero backup "worked" without holding what I thought it held. The first was &lt;a href="https://dev.to/blog/velero-backup-false-positive-no-data/"&gt;Velero reporting Completed with no PVC data at all&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;List &lt;code&gt;PodVolumeBackups&lt;/code&gt; with byte counts&lt;/strong&gt; after any change to backup scope. The backup status tells you nothing about what was copied.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not back up a running Postgres data directory with Velero fs-backup.&lt;/strong&gt; It is large because of WAL, and it is not consistent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check compression yourself.&lt;/strong&gt; Velero's Kopia uploader stored data uncompressed in v1.14.1, whatever your comments say.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip emptyDirs&lt;/strong&gt; with a volume policy if you use &lt;code&gt;defaultVolumesToFsBackup: true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dump in a pre-backup hook&lt;/strong&gt; and validate the archive with &lt;code&gt;pg_restore --list&lt;/code&gt; before replacing the previous one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;on-error: Continue&lt;/code&gt; and alert on &lt;code&gt;PartiallyFailed&lt;/code&gt;&lt;/strong&gt;, so one bad database does not cost you the dumps that worked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restore a dump into the oldest server version you run.&lt;/strong&gt; That is how I found the &lt;code&gt;transaction_timeout&lt;/code&gt; problem before I needed the backup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Further reading:&lt;/strong&gt; &lt;a href="https://dev.to/go/4aUtkCs"&gt;Designing Data-Intensive Applications by Martin Kleppmann*&lt;/a&gt; explains why a database copy taken from under a running server is not the same as a consistent dump, which is the whole reason this setup uses &lt;code&gt;pg_dump&lt;/code&gt;.&lt;/p&gt;



</description>
      <category>kubernetes</category>
      <category>backup</category>
      <category>velero</category>
      <category>postgres</category>
    </item>
    <item>
      <title>KRITIS Compliance in Azure: Mapping BSIG §§ 30-39 to Terraform</title>
      <dc:creator>david</dc:creator>
      <pubDate>Thu, 03 Dec 2026 16:53:06 +0000</pubDate>
      <link>https://dev.to/dwoitzik/kritis-compliance-in-azure-mapping-bsig-ssss-30-39-to-terraform-923</link>
      <guid>https://dev.to/dwoitzik/kritis-compliance-in-azure-mapping-bsig-ssss-30-39-to-terraform-923</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/kritis-bsig-azure-terraform/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most KRITIS write-ups are aimed at Betreiber (operators) and their compliance officers: long PDFs full of "geeignete, verhältnismäßige und wirksame technische und organisatorische Maßnahmen" without a single line of code. That doesn't help the engineer who has to build the infrastructure a KRITIS auditor will later sign off on.&lt;/p&gt;

&lt;p&gt;This article maps the technical obligations the BSI-Gesetz puts on operators of critical facilities to Azure resources, managed with Terraform, in the same Hub &amp;amp; Spoke architecture already covered on this blog.&lt;/p&gt;

&lt;p&gt;If you learned KRITIS as "§8a BSIG": that section no longer exists. The NIS2 implementation act (NIS2UmsuCG) rewrote the BSIG in December 2025. The duties that used to sit in §8a are now spread across §30 (risk management for all NIS2 entities), §31 (additional requirements for Betreiber kritischer Anlagen, including attack detection), §32 (incident reporting) and §39 (proof of compliance). The section numbers below refer to the current BSIG.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; This is not legal advice. KRITIS status itself is a threshold question (Betreiber kritischer Anlagen, determined by the sector thresholds, still taken from the BSI-KritisV until the new ordinance under the KRITIS-Dachgesetz replaces it) that a lawyer or compliance officer has to answer, not an infrastructure article. What follows covers the technical network and detection controls the BSIG names, not the organizational program around them (registration, proof documentation, sector-specific B3S standards).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What the BSIG Requires from KRITIS Operators
&lt;/h2&gt;

&lt;p&gt;Strip away the legal language and the BSIG asks four concrete things of a KRITIS operator's IT systems:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Risk management measures at the state of the art (§30, §31 Abs. 1)&lt;/strong&gt;&lt;br&gt;
Every NIS2 entity must take "appropriate, proportionate and effective" technical and organizational measures, and they should follow the "Stand der Technik" (§30 Abs. 1 and 2). Operators of critical facilities must go further wherever the effort is not out of proportion to the consequences of an outage (§31 Abs. 1). "Stand der Technik" is a moving target by design: what counted as state of the art in 2022 does not in 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Systems to detect attacks ("Systeme zur Angriffserkennung", SzA, §31 Abs. 2)&lt;/strong&gt;&lt;br&gt;
Mandatory for KRITIS operators since May 2023 (then under §8a Abs. 1a) and carried over into the new law. The systems must continuously and automatically collect and evaluate relevant parameters from live operations, identify threats, and support remediation. A firewall that produces logs nobody reads does not qualify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Proof of compliance ("Nachweispflicht", §39)&lt;/strong&gt;&lt;br&gt;
KRITIS operators must prove to the BSI, through audits, inspections or certifications, that the measures are in place. Under the old §8a this was every two years; §39 now requires it every three years, with the first deadline set by the BSI. Undocumented, unreproducible infrastructure fails this by default because there is nothing to show an auditor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Incident reporting (§32)&lt;/strong&gt;&lt;br&gt;
Significant security incidents go to the joint reporting office of BSI and BBK in three stages: an early warning within 24 hours of becoming aware, an incident notification within 72 hours, and a final report one month after that. You cannot report what your infrastructure never logged.&lt;/p&gt;
&lt;h2&gt;
  
  
  Mapping the BSIG Duties to Azure Architecture
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BSIG Requirement                  →    Azure Control
──────────────────────────────────────────────────────────
Stand der Technik (Segmentation)  →    Hub &amp;amp; Spoke VNet topology
                                        NSG Default-Deny
Stand der Technik (Access)        →    Azure Firewall + Forced Tunneling
                                        Managed Identities, no static keys
Angriffserkennung (SzA)           →    VNet Flow Logs → Log Analytics
                                        Azure Firewall threat intelligence mode
Nachweispflicht (Evidence)        →    Terraform state + Git history
                                        Azure Policy compliance dashboard
Incident Reporting (24h clock)    →    Diagnostic Settings on every resource
                                        Centralized Log Analytics workspace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The Hub &amp;amp; Spoke foundation is the same one behind the &lt;a href="https://dev.to/blog/nis2-article-21-azure-terraform/"&gt;NIS2 Article 21 mapping&lt;/a&gt; on this blog. That's expected: since the reform, the NIS2 duties and the KRITIS duties live in the same BSIG, and §31 builds directly on §30. What's different for KRITIS is Control 2 below. SzA is a named, mandatory control, not an implicit "monitoring is good practice" recommendation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/terraform-azurerm-hub-spoke" rel="noopener noreferrer"&gt;Get the base Hub &amp;amp; Spoke module free on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Control 1: Segmentation as the Baseline
&lt;/h2&gt;

&lt;p&gt;Nothing here differs from a well-built NIS2 deployment. Both start from the same premise: a flat network with unrestricted lateral movement cannot be "Stand der Technik" for critical infrastructure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_network_security_group"&lt;/span&gt; &lt;span class="s2"&gt;"kritis_baseline"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"nsg-kritis-baseline-${var.environment}"&lt;/span&gt;
  &lt;span class="n"&gt;location&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;
  &lt;span class="n"&gt;resource_group_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resource_group_name&lt;/span&gt;

  &lt;span class="n"&gt;security_rule&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;                       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Deny-Internet-Inbound"&lt;/span&gt;
    &lt;span class="n"&gt;priority&lt;/span&gt;                   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt;
    &lt;span class="n"&gt;direction&lt;/span&gt;                  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Inbound"&lt;/span&gt;
    &lt;span class="n"&gt;access&lt;/span&gt;                     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Deny"&lt;/span&gt;
    &lt;span class="n"&gt;protocol&lt;/span&gt;                   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt;
    &lt;span class="n"&gt;source_address_prefix&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Internet"&lt;/span&gt;
    &lt;span class="n"&gt;destination_address_prefix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt;
    &lt;span class="n"&gt;source_port_range&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt;
    &lt;span class="n"&gt;destination_port_range&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_subnet_network_security_group_association"&lt;/span&gt; &lt;span class="s2"&gt;"spoke_bind"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;subnet_id&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spoke_default&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;network_security_group_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_network_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kritis_baseline&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference from a generic hardening pass is that for KRITIS, this NSG configuration becomes evidence in the §39 audit. An auditor doesn't want a screenshot of the Azure portal. They want to see that the control existed at deployment time and has stayed in place, and a &lt;code&gt;terraform plan&lt;/code&gt; showing zero drift demonstrates exactly that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 2: Systeme zur Angriffserkennung (SzA)
&lt;/h2&gt;

&lt;p&gt;Most infrastructure-as-code write-ups skip this control entirely, and it's the one that is mandatory for KRITIS operators. SzA requires continuous collection and analysis of security-relevant events. In Azure terms, that means flow logs shipped to a Log Analytics workspace, not sitting unused in a storage account.&lt;/p&gt;

&lt;p&gt;Use VNet flow logs, not NSG flow logs. Azure has blocked the creation of new NSG flow logs since June 30, 2025, and retires them entirely on September 30, 2027. VNet flow logs attach to the virtual network and capture traffic for every subnet and NIC in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_network_watcher_flow_log"&lt;/span&gt; &lt;span class="s2"&gt;"spoke_flow_log"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;network_watcher_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_network_watcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
  &lt;span class="n"&gt;resource_group_name&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_resource_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"fl-spoke-${var.environment}"&lt;/span&gt;

  &lt;span class="n"&gt;target_resource_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_virtual_network&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spoke&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;storage_account_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_storage_account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;flow_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;enabled&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

  &lt;span class="n"&gt;retention_policy&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="n"&gt;days&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;traffic_analytics&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;enabled&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="n"&gt;workspace_id&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_log_analytics_workspace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;soc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;workspace_id&lt;/span&gt;
    &lt;span class="n"&gt;workspace_region&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;
    &lt;span class="n"&gt;workspace_resource_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_log_analytics_workspace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;soc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
    &lt;span class="n"&gt;interval_in_minutes&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;traffic_analytics&lt;/code&gt; turns raw flow logs into something you can detect with. It enriches flows with Microsoft's threat intelligence, flags traffic to and from known-malicious IPs, and surfaces it in the Log Analytics workspace. That is what "Angriffserkennung" means in practice rather than in policy language. Azure offers processing intervals of 10 or 60 minutes. A system that has to justify its detection latency to an auditor should use 10.&lt;/p&gt;

&lt;p&gt;Flow logs plus Traffic Analytics cover the network layer. A complete SzA in the BSI's sense usually also needs a SIEM layer (Microsoft Sentinel on the same workspace, for example) with detection rules and someone who responds to them.&lt;/p&gt;

&lt;p&gt;Pair this with Azure Firewall's threat intelligence mode set to &lt;code&gt;Deny&lt;/code&gt; rather than &lt;code&gt;Alert&lt;/code&gt;. For KRITIS infrastructure, alerting on a known-malicious IP without blocking it falls short of the "Stand der Technik" bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_firewall"&lt;/span&gt; &lt;span class="s2"&gt;"kritis_fw"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"fw-kritis-${var.environment}"&lt;/span&gt;
  &lt;span class="n"&gt;sku_name&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AZFW_VNet"&lt;/span&gt;
  &lt;span class="n"&gt;sku_tier&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Standard"&lt;/span&gt;

  &lt;span class="n"&gt;threat_intel_mode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Deny"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Control 3: Nachweispflicht and the Evidence Trail
&lt;/h2&gt;

&lt;p&gt;The §39 proof requirement is where infrastructure-as-code stops being a nice-to-have and becomes the compliance mechanism. Azure Policy assignments give you a running compliance dashboard instead of a point-in-time audit scramble:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_subscription_policy_assignment"&lt;/span&gt; &lt;span class="s2"&gt;"require_vnet_flow_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"require-flow-logs"&lt;/span&gt;
  &lt;span class="n"&gt;policy_definition_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/providers/Microsoft.Authorization/policyDefinitions/4c3c6c5f-0d47-4402-99b8-aa543dd8bcee"&lt;/span&gt;
  &lt;span class="n"&gt;subscription_id&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;azurerm_subscription&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;display_name&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Audit flow logs configuration for every virtual network"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every Terraform apply traces back to a timestamped, attributable Git commit. Every policy assignment keeps verifying that the control is still in place after deployment. When the three-year audit comes around, the evidence is &lt;code&gt;git log&lt;/code&gt; plus the Azure Policy compliance report, not a fire drill reconstructing what was deployed two years ago.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 4: The Incident Reporting Clock
&lt;/h2&gt;

&lt;p&gt;The 24-hour early warning under §32 runs from the moment you become aware of a significant incident. You only become aware if something logged it, so Diagnostic Settings on every security-relevant resource, feeding one workspace, are a prerequisite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"azurerm_monitor_diagnostic_setting"&lt;/span&gt; &lt;span class="s2"&gt;"fw_diagnostics"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"diag-fw-${var.environment}"&lt;/span&gt;
  &lt;span class="n"&gt;target_resource_id&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_firewall&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kritis_fw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;log_analytics_workspace_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;azurerm_log_analytics_workspace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;soc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;

  &lt;span class="n"&gt;enabled_log&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AzureFirewallApplicationRule"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;enabled_log&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AzureFirewallNetworkRule"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;enabled_log&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AzureFirewallDnsProxy"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without this, the first question an incident report has to answer ("when did it start, and what happened?") has no reliable source of truth. Diagnostic Settings applied uniformly across every resource in the Hub &amp;amp; Spoke, not just the ones that seemed important at design time, make that question answerable after the fact.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Covers and What It Doesn't
&lt;/h2&gt;

&lt;p&gt;This addresses the technical network security and detection controls behind §§30-32 and §39 BSIG. Full KRITIS compliance also requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Determining KRITIS status itself:&lt;/strong&gt; the sector thresholds, a legal and organizational question this article does not touch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Registration:&lt;/strong&gt; critical facilities register under §8 KRITIS-Dachgesetz (§33 Abs. 2 BSIG), with contact details kept current&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sector-specific security standards (B3S):&lt;/strong&gt; an optional route under §30 Abs. 9 to define what "Stand der Technik" means for your sector, usually going well beyond generic network controls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The organizational incident response process&lt;/strong&gt; around the technical logging covered above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Physical resilience and personnel security&lt;/strong&gt;, which the KRITIS-Dachgesetz and §30 address outside the scope of cloud infrastructure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;A Hub &amp;amp; Spoke deployment built against the KRITIS sections of the BSIG gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network segmentation and default-deny as the baseline, not a follow-up ticket&lt;/li&gt;
&lt;li&gt;VNet flow logs with Traffic Analytics as the network-layer part of "Angriffserkennung," not just log storage&lt;/li&gt;
&lt;li&gt;Azure Firewall threat intelligence in blocking mode&lt;/li&gt;
&lt;li&gt;Continuous Azure Policy compliance evidence for the §39 audit&lt;/li&gt;
&lt;li&gt;A centralized, timestamped log trail that answers the first question of a §32 report&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same &lt;a href="https://github.com/dwoitzik/terraform-azurerm-hub-spoke" rel="noopener noreferrer"&gt;Hub &amp;amp; Spoke module&lt;/a&gt; behind the &lt;a href="https://dev.to/blog/nis2-article-21-azure-terraform/"&gt;NIS2 Article 21 mapping&lt;/a&gt; on this blog is the foundation here too. KRITIS doesn't need a different network architecture. It needs the detection and evidence layer on top of the same segmentation.&lt;/p&gt;

&lt;p&gt;If the underlying networking concepts (peering, flow logs, segmentation) are the unfamiliar part rather than the Terraform syntax, &lt;a href="https://dev.to/go/4f3kTar"&gt;Netzwerke: Verstehen, Einrichten, Administrieren*&lt;/a&gt; is the reference I keep coming back to.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>terraform</category>
      <category>compliance</category>
      <category>security</category>
    </item>
    <item>
      <title>A DDNS CNAME with a 60 s TTL Made My Headscale Look Down</title>
      <dc:creator>david</dc:creator>
      <pubDate>Thu, 03 Dec 2026 16:52:31 +0000</pubDate>
      <link>https://dev.to/dwoitzik/a-ddns-cname-with-a-60-s-ttl-made-my-headscale-look-down-5d5k</link>
      <guid>https://dev.to/dwoitzik/a-ddns-cname-with-a-60-s-ttl-made-my-headscale-look-down-5d5k</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/headscale-ddns-cname-60s-ttl-slow-dns/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On 2026-10-16 and 2026-10-17 my critical &lt;code&gt;SLOAvailabilityFastBurn&lt;/code&gt; alert kept firing for &lt;code&gt;https://headscale.woitzik.dev&lt;/code&gt;, the control plane every device on my tailnet registers against. The blackbox probe recorded 48 failures in about 17 hours. Headscale was never down. Every failure was a DNS lookup that hit a ceiling of about 9.5 seconds, because the public name was a CNAME to MikroTik's IP Cloud DDNS hostname, and that hostname's A record carries a 60-second TTL. The fix was to stop chasing the router's DDNS: a DNS-only Cloudflare A record, kept current by a small CronJob, with Terraform told to ignore the record's content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Symptom
&lt;/h2&gt;

&lt;p&gt;The probe is a Prometheus blackbox job, &lt;code&gt;blackbox-http&lt;/code&gt;, running the &lt;code&gt;http_auth_ok&lt;/code&gt; module every 60 seconds against two public names: &lt;code&gt;headscale.woitzik.dev&lt;/code&gt; and &lt;code&gt;photos.woitzik.dev&lt;/code&gt;. The burn-rate rules on top of it are the ones from &lt;a href="https://dev.to/blog/slo-burn-rate-alerting-prometheus-k3s/"&gt;SLO burn-rate alerting with Prometheus&lt;/a&gt;, with a 99.9% target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SLOAvailabilityFastBurn&lt;/span&gt;
  &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;(1 - job_instance:probe_success:rate2h) &amp;gt; (30 * (1 - 0.999))&lt;/span&gt;
    &lt;span class="s"&gt;and&lt;/span&gt;
    &lt;span class="s"&gt;(1 - job_instance:probe_success:rate1h) &amp;gt; (30 * (1 - 0.999))&lt;/span&gt;
  &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2m&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;critical&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At a 99.9% target, 48 failed probes in 17 hours burns budget fast enough to page. &lt;code&gt;photos.woitzik.dev&lt;/code&gt;, probed by the same job from the same pod, recorded zero failures in the same window. Same exporter, same network, same resolver. Only one name was failing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagnosis: The Probe Never Connected
&lt;/h2&gt;

&lt;p&gt;Two blackbox metrics answered the question before I looked at Headscale at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;probe_http_status_code{instance="https://headscale.woitzik.dev"}
probe_dns_lookup_time_seconds{instance="https://headscale.woitzik.dev"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every failed probe had &lt;code&gt;probe_http_status_code = 0&lt;/code&gt; and &lt;code&gt;probe_dns_lookup_time_seconds&lt;/code&gt; at about 9.50 s. A status code of 0 means there was no HTTP response at all: the probe never got as far as connecting. And 9.5 s, every single time, is not a slow server. It is a timeout ceiling. DNS resolution itself was timing out.&lt;/p&gt;

&lt;p&gt;On every probe that &lt;em&gt;did&lt;/em&gt; resolve, Headscale answered &lt;code&gt;200&lt;/code&gt;. So the service was fine and the alert was measuring name resolution.&lt;/p&gt;

&lt;p&gt;The successful lookups gave the rest of it away. They were bimodal: p50 0.07 s, p95 8.1 s. Most lookups came back from cache almost instantly, and a meaningful share took eight seconds. Whenever one crossed the ~9.5 s tolerance, the probe failed outright.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause: Two Records, Two TTLs
&lt;/h2&gt;

&lt;p&gt;The public name was a chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;headscale.woitzik.dev        CNAME  &amp;lt;serial&amp;gt;.sn.mynetname.net   (ttl 300)
&amp;lt;serial&amp;gt;.sn.mynetname.net    A      &amp;lt;home WAN IP&amp;gt;               (ttl 60)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;&amp;lt;serial&amp;gt;.sn.mynetname.net&lt;/code&gt; is MikroTik's IP Cloud DDNS name. In my network stack it is a single Terraform resource:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"routeros_ip_cloud"&lt;/span&gt; &lt;span class="s2"&gt;"ddns"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ddns_enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"yes"&lt;/span&gt;
  &lt;span class="n"&gt;update_time&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CNAME on my side had a 300 s TTL. The A record at the end of the chain belongs to MikroTik and has a 60 s TTL. A recursive resolver can cache the CNAME for five minutes, but it has to go back to MikroTik's authoritative servers for the A record roughly every minute. Those servers intermittently took 8 to 9 seconds to answer. Any lookup that landed on an expired A record paid that price.&lt;/p&gt;

&lt;p&gt;The CNAME dated from late August, when Headscale moved off the Cloudflare Tunnel and the record was pointed straight at the router's DDNS name. No extra job, because the router already keeps that name current. What it also did was put the resolution latency of my control plane in the hands of a DDNS service I don't control, behind a TTL I can't change.&lt;/p&gt;

&lt;p&gt;This was not only a monitoring problem. Every client resolving &lt;code&gt;headscale.woitzik.dev&lt;/code&gt; went through the same DDNS target and saw the same eight-second lookups. The probe was just the client that kept a record.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Record Is DNS-Only in the First Place
&lt;/h2&gt;

&lt;p&gt;Headscale cannot sit behind Cloudflare's proxy. Its TS2021 registration protocol does not survive the proxy, and the &lt;code&gt;Upgrade&lt;/code&gt; header gets dropped by &lt;code&gt;cloudflared&lt;/code&gt; and Traefik on the tunnel path. That is why, in &lt;a href="https://dev.to/blog/cloudflare-tunnel-zero-inbound-ports/"&gt;my Cloudflare Tunnel setup with zero inbound ports&lt;/a&gt;, Headscale is one of the two exceptions with &lt;code&gt;proxied = false&lt;/code&gt;. Whatever the fix was, it had to stay a plain DNS record pointing at the WAN IP.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix (ADR-059, #921)
&lt;/h2&gt;

&lt;p&gt;Three parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. A Cloudflare A record instead of the CNAME.&lt;/strong&gt; Resolution is then served by Cloudflare's authoritative DNS, with no second hop to MikroTik:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"cloudflare_dns_record"&lt;/span&gt; &lt;span class="s2"&gt;"dns_headscale_dmz"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;zone_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zone_id&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"headscale"&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"A"&lt;/span&gt;
  &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"192.0.2.1"&lt;/span&gt;
  &lt;span class="n"&gt;proxied&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="n"&gt;ttl&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;
  &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"DMZ direct WAN path, Tunnel incompatible w/ headscale TS2021"&lt;/span&gt;

  &lt;span class="n"&gt;lifecycle&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;# The DDNS CronJob owns content; the placeholder only seeds a recreate.&lt;/span&gt;
    &lt;span class="n"&gt;ignore_changes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Terraform owns the record, not its content.&lt;/strong&gt; &lt;code&gt;192.0.2.1&lt;/code&gt; is an RFC 5737 documentation address. It only matters if the record is ever recreated. &lt;code&gt;ignore_changes = [content]&lt;/code&gt; stops every &lt;code&gt;plan&lt;/code&gt; from trying to revert the live IP to the placeholder, and it keeps my home WAN IP out of the repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. A CronJob keeps the IP current.&lt;/strong&gt; &lt;code&gt;kubernetes/system/infrastructure/cloudflare-ddns.yml&lt;/code&gt; runs every five minutes, reads the public IP and updates the record only if it changed. The core of the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CURRENT_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;curl -s --max-time 10 https://api.ipify.org&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; -z &lt;span class="s2"&gt;"$CURRENT_IP"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Failed to determine public IP, skipping"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="nv"&gt;RECORD_JSON&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;curl -s --max-time 10 \
  -H &lt;span class="s2"&gt;"Authorization: Bearer ${CF_API_TOKEN}"&lt;/span&gt; \
  &lt;span class="s2"&gt;"https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?type=A&amp;amp;name=${RECORD_NAME}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="c"&gt;# Fail loud on API rejection so a dead token surfaces as a&lt;/span&gt;
&lt;span class="c"&gt;# failed Job rather than silently doing nothing.&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; ! &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"$RECORD_JSON"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -q &lt;span class="s1"&gt;'"success":true'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Cloudflare API rejected the record lookup: $RECORD_JSON"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that it compares the record's current content with &lt;code&gt;CURRENT_IP&lt;/code&gt; and sends a &lt;code&gt;PUT&lt;/code&gt; with &lt;code&gt;"ttl":300,"proxied":false&lt;/code&gt; only on a change. A few choices in it were deliberate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A failed IP lookup exits 0.&lt;/strong&gt; If &lt;code&gt;api.ipify.org&lt;/code&gt; is unreachable, the right move is to leave the record alone, not to fail and page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An API rejection exits 1.&lt;/strong&gt; A dead token has to show up as a failed Job, not as a job that succeeds every five minutes while doing nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A missing record exits 0.&lt;/strong&gt; Terraform owns creating it, and the job can run once before that apply lands.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;concurrencyPolicy: Forbid&lt;/code&gt; and &lt;code&gt;ttlSecondsAfterFinished: 86400&lt;/code&gt;, so a single old failure doesn't keep &lt;code&gt;KubeJobFailed&lt;/code&gt; firing forever.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The job runs in the &lt;code&gt;cert-manager&lt;/code&gt; namespace because the &lt;code&gt;cloudflare-api-token-secret&lt;/code&gt; (Zone:DNS:Edit) and a broad egress allow on 443 already exist there. That is a layering smell, and the ADR says so. It avoided a second copy of the token and a new NetworkPolicy.&lt;/p&gt;

&lt;p&gt;The record type change has one sharp edge: CNAME to A forces replacement in the Cloudflare provider, so the first apply destroys and recreates the record. The PR stated that blast radius (a brief DNS gap) and the rollback (revert to the CNAME) before the apply went through the &lt;code&gt;terraform-apply&lt;/code&gt; gate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trade-Off
&lt;/h2&gt;

&lt;p&gt;With the MikroTik DDNS, a WAN IP change propagated in about a minute. Now it takes up to five minutes for the CronJob plus the 300 s TTL. Slower convergence when the IP changes is a better trade than slow resolution on every expired cache entry.&lt;/p&gt;

&lt;p&gt;I rejected two alternatives. Loosening the probe (more retries, longer timeout) would have silenced the alert while every real client kept the slow lookups. Raising the TTL was not possible, because the 60 s TTL belongs to MikroTik's record, not mine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification
&lt;/h2&gt;

&lt;p&gt;A public resolver now returns a plain A record for the name, with no CNAME in the answer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig +noall +answer headscale.woitzik.dev @1.1.1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My alert runbook got a new row for this alert: check &lt;code&gt;probe_http_status_code&lt;/code&gt; and &lt;code&gt;probe_dns_lookup_time_seconds&lt;/code&gt; for the instance before touching Headscale. If the status is 0 and lookup time dominates, it was resolution, not the service.&lt;/p&gt;

&lt;p&gt;While reading the alert, I also found that the burn-rate annotations printed the fractional error rate with a literal &lt;code&gt;%&lt;/code&gt;, understating it by a factor of 100. That went into a separate PR to keep this change to one concern. The rule now uses &lt;code&gt;humanizePercentage&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Status code 0 plus a constant lookup time is a DNS timeout.&lt;/strong&gt; Check &lt;code&gt;probe_dns_lookup_time_seconds&lt;/code&gt; before restarting anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A CNAME inherits the worst TTL in the chain.&lt;/strong&gt; Your own 300 s TTL means nothing if the target's A record expires every 60 s.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Know who answers authoritatively for every hop.&lt;/strong&gt; A router vendor's DDNS service is now part of your availability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare with a sibling target.&lt;/strong&gt; One failing name next to a healthy one on the same probe rules out the probe, the network and the resolver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let Terraform own the shape, not the dynamic value.&lt;/strong&gt; &lt;code&gt;ignore_changes = [content]&lt;/code&gt; lets a job and Terraform share one record without fighting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make the DDNS job fail loudly on auth errors and quietly on transient lookups.&lt;/strong&gt; The opposite gets you either alert noise or a silent stale record.&lt;/li&gt;
&lt;/ul&gt;



</description>
      <category>dns</category>
      <category>monitoring</category>
      <category>networking</category>
      <category>homelab</category>
    </item>
    <item>
      <title>Proxmox Backup Server on a Budget: 3-2-1 Minus the Offsite Copy</title>
      <dc:creator>david</dc:creator>
      <pubDate>Mon, 30 Nov 2026 18:46:48 +0000</pubDate>
      <link>https://dev.to/dwoitzik/proxmox-backup-server-on-a-budget-3-2-1-minus-the-offsite-copy-2cj0</link>
      <guid>https://dev.to/dwoitzik/proxmox-backup-server-on-a-budget-3-2-1-minus-the-offsite-copy-2cj0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/proxmox-backup-server-321-budget/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The 3-2-1 rule asks for 3 copies of your data, on 2 different media, with 1 offsite. Proxmox Backup Server (PBS) covers the "2 media" part cheaply: on my homelab it runs directly on the Proxmox VE host, a &lt;a href="https://dev.to/go/4bv3yF1"&gt;BMAX Mini PC*&lt;/a&gt;, and writes deduplicated snapshots of every VM and LXC to a &lt;a href="https://dev.to/go/4vxwLpY"&gt;2TB Seagate External HDD*&lt;/a&gt;. That part works and is checked after every run. The "1 offsite" part for PBS does not exist right now. My only active offsite copy is Velero's, and it covers a handful of Kubernetes namespaces, not the VM images. This post describes the setup as it actually runs, including the gap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PBS on the Proxmox Host
&lt;/h2&gt;

&lt;p&gt;PBS used to live in its own LXC (&lt;code&gt;ct-mgmt-pbs-01&lt;/code&gt;). That container is gone. PBS now runs host-native on &lt;code&gt;pve-mgmt-01&lt;/code&gt;, installed from the &lt;code&gt;pbs-no-subscription&lt;/code&gt; repository next to PVE. Ansible manages the install (&lt;code&gt;ansible/roles/pbs/&lt;/code&gt;): it removes the enterprise repo files, adds the PBS repo as a deb822 source, and installs &lt;code&gt;proxmox-backup-server&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The datastore sits on the ZFS pool &lt;code&gt;archive&lt;/code&gt;, a single-vdev pool on the USB HDD, mounted at &lt;code&gt;/mnt/pbs-storage&lt;/code&gt;. In PVE it shows up as the storage &lt;code&gt;local-pbs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Co-locating PBS with PVE saves the RAM and disk of a dedicated guest. The cost is that a dead host takes PBS with it. Restoring after host loss starts with reinstalling PVE and PBS and re-importing the &lt;code&gt;archive&lt;/code&gt; pool from the HDD, which is the main reason the HDD is external and not inside the box.&lt;/p&gt;

&lt;p&gt;One hardware detail is load-bearing: the HDD must sit on a USB 3 port. On USB 3 it reads around 60 MB/s. When it ended up on a USB 2 port, throughput dropped to 3 to 13 MB/s, which turns a backup window into a backup night.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Backup Job
&lt;/h2&gt;

&lt;p&gt;PBS doesn't pull backups. PVE pushes them through a regular vzdump job that targets the PBS storage. Mine lives in &lt;code&gt;/etc/pve/jobs.cfg&lt;/code&gt;, and &lt;code&gt;pvescheduler&lt;/code&gt; logs it like this when it starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO: starting new backup job: vzdump
  --mailnotification failure --node pve-mgmt-01 --quiet 1 --storage local-pbs
  --compress zstd --exclude 9000 --all 1
  --prune-backups 'keep-daily=7,keep-weekly=4' --mode snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The schedule is &lt;code&gt;*-*-01/2 03:00&lt;/code&gt;, so every other night at 03:00, not daily. Every guest is included except VM &lt;code&gt;9000&lt;/code&gt;, the cloud-init template, which holds no unique state. Retention is 7 daily and 4 weekly snapshots. A full run takes roughly 76 minutes.&lt;/p&gt;

&lt;p&gt;That run is not free on a single-disk host. All VM and LXC disks live on one DRAM-less NVMe, and a snapshot-mode backup reads every guest disk while the guests keep writing. vzdump's global throttle in &lt;code&gt;/etc/vzdump.conf&lt;/code&gt; (Ansible-managed, see ADR-023) keeps it from starving everything else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bwlimit: 51200
ionice: 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;bwlimit&lt;/code&gt; is in KiB/s, so 50 MiB/s. Even throttled, the job pushes host load well past what normal daytime work does. My host watchdog alerts on load, and it now raises its threshold only while a &lt;code&gt;vzdump&lt;/code&gt; process is actually running (ADR-053), so the backup window stops paging me every night.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking That Backups Are Real
&lt;/h2&gt;

&lt;p&gt;A green vzdump exit status is not proof of a usable backup. Two guests once produced 1-byte "successful" backups for two nights in a row before failing outright. Since then a vzdump hook script (the &lt;code&gt;script:&lt;/code&gt; directive in &lt;code&gt;/etc/vzdump.conf&lt;/code&gt;) runs at &lt;code&gt;job-end&lt;/code&gt;. It reads what was actually committed to &lt;code&gt;local-pbs&lt;/code&gt; via &lt;code&gt;pvesm list&lt;/code&gt;, flags any guest whose newest backup is missing, too old, or smaller than 100 MiB, sends an ntfy alert, and writes a &lt;code&gt;pve_pbs_backup_healthy&lt;/code&gt; metric for Prometheus.&lt;/p&gt;

&lt;p&gt;Restores also run from the PVE side, either in the web UI (select &lt;code&gt;local-pbs&lt;/code&gt;, open Backups, pick the snapshot, Restore) or on the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# List available backups on the PBS storage&lt;/span&gt;
pvesm list local-pbs --content backup

&lt;span class="c"&gt;# Restore a container or a VM from a specific snapshot&lt;/span&gt;
pct restore &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vmid&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; local-pbs:backup/ct/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vmid&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;timestamp&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --storage local-lvm
qmrestore local-pbs:backup/vm/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vmid&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;timestamp&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vmid&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hook proves a backup landed with a plausible size. It does not prove the guest boots or the data inside is intact. That takes a real restore to a scratch target, which is on my quarterly DR checklist but not automated yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pruning Has a Blind Spot
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;--prune-backups&lt;/code&gt; option only reaches guests that still exist in the Proxmox config. Snapshots of deleted guests, and of guests added to the job's &lt;code&gt;exclude&lt;/code&gt; list later, are never pruned. On my datastore that left 29 orphaned snapshots: 15 from the retired PBS LXC, 12 from the template VM excluded after the fact, and 2 from abandoned recovery clones. Their logical size adds up to roughly 300 GB, but because PBS deduplicates, they account for far less of the 212 GB the datastore actually references. Cleaning them up is hygiene, not a space win. The inventory comes from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pvesm list local-pbs --content backup &lt;span class="o"&gt;|&lt;/span&gt; awk &lt;span class="s1"&gt;'{print $5}'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sort -n &lt;span class="o"&gt;|&lt;/span&gt; uniq -c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Missing Offsite Leg
&lt;/h2&gt;

&lt;p&gt;This is where my setup does not meet 3-2-1.&lt;/p&gt;

&lt;p&gt;The original plan synced the PBS datastore to Google Drive with rclone (&lt;code&gt;gdrive:Backup-Homelab/PBS&lt;/code&gt;). The config and script are still deployed by the &lt;code&gt;pbs&lt;/code&gt; role, but the cron job is deliberately &lt;code&gt;state: absent&lt;/code&gt;. Two reasons. First, the Drive account doesn't have the free space for the datastore. Second, even before the quota ran out, the sync almost never finished: a PBS datastore is tens of thousands of small chunk files, and Google Drive's API throttles that pattern hard. A manual test sync ran at about 1.6 KiB/s with an ETA of roughly 12 weeks for the first full copy. I wrote that one up separately in &lt;a href="https://dev.to/blog/google-drive-api-throttling-backup-chunk-storage/"&gt;Google Drive API throttling vs. PBS chunk storage&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cloudflare R2 is offsite and active, but it holds Velero backups only: the &lt;code&gt;apps&lt;/code&gt;, &lt;code&gt;vault&lt;/code&gt;, &lt;code&gt;database&lt;/code&gt;, and &lt;code&gt;argocd&lt;/code&gt; namespaces, with large volumes excluded, kept for 3 days. A guard pauses that schedule before usage hits R2's 10GB free tier. 212 GB of PBS data doesn't fit that budget. At R2's list price of $0.015/GB-month it would come to roughly $3 a month for storage, plus operation charges for the chunk uploads, so it is affordable but not free, and it is a decision I haven't made yet. Unlike &lt;a href="https://dev.to/blog/velero-garage-k3s-backup/"&gt;Garage&lt;/a&gt;, which runs inside the cluster it backs up, R2 sits outside the host entirely, and that independence is the whole point of &lt;a href="https://dev.to/blog/velero-backup-circularity-garage-r2-offsite/"&gt;an offsite target&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So the honest count today: the live guests on the NVMe plus the PBS copy on the HDD give two copies on two media, both in the same room. Velero adds a third copy of the critical Kubernetes data in Garage and an offsite one in R2. The VM and LXC images have no offsite copy. The realistic options are a long unattended initial sync to a better-suited target, bundling chunks before upload, or paying for object storage sized to the datastore. Until one of those is in place, a fire or theft takes the PBS backups along with the host. The wider picture across all backup layers is in &lt;a href="https://dev.to/blog/321-backup-velero-pbs-offsite/"&gt;my 3-2-1 setup with Velero, PBS, and offsite&lt;/a&gt;.&lt;/p&gt;



</description>
      <category>proxmox</category>
      <category>backup</category>
      <category>pbs</category>
      <category>homelab</category>
    </item>
    <item>
      <title>Trivy Operator Saturated My NVMe: Retried Scans and a Shared Cache</title>
      <dc:creator>david</dc:creator>
      <pubDate>Sun, 29 Nov 2026 14:00:43 +0000</pubDate>
      <link>https://dev.to/dwoitzik/trivy-operator-saturated-my-nvme-retried-scans-and-a-shared-cache-2e32</link>
      <guid>https://dev.to/dwoitzik/trivy-operator-saturated-my-nvme-retried-scans-and-a-shared-cache-2e32</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/trivy-operator-nvme-saturation-scan-retry-loop/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My Proxmox host was writing about 16 MB/s to its only NVMe, around the clock, and the source was one k3s VM. Inside that VM it was the Trivy Operator. Its scan jobs never finished: each one failed with &lt;code&gt;unable to initialize fs cache: cache may be in use by another process: timeout&lt;/code&gt;, retried, downloaded the Trivy DB again, pulled the image layers again, and failed again. On a single DRAM-less NVMe that was enough to push write latency to around 200 ms, time out the k3s API server and a kubelet, and set off a container restart storm. The fix was &lt;code&gt;replicas: 0&lt;/code&gt; in Git. Scaling to zero with kubectl had already failed once, two months earlier, because ArgoCD put the replica back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hardware Constraint
&lt;/h2&gt;

&lt;p&gt;Everything in my homelab runs on one Proxmox host with one DRAM-less consumer NVMe (ADR-034). There is no second disk to move noisy jobs onto. Every VM, every LXC and every container shares the same device, so one component with a write habit becomes everyone's latency problem. I've hit this before with a &lt;a href="https://dev.to/blog/staggered-vm-boot-load-average-147/"&gt;boot storm that pushed the load average to 147&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding the Second Writer
&lt;/h2&gt;

&lt;p&gt;This incident started with a different fix. On 2026-10-16, PR #908 changed the Vault unseal sidecar to poll &lt;code&gt;/v1/sys/seal-status&lt;/code&gt; over HTTP instead of exec'ing the &lt;code&gt;vault&lt;/code&gt; CLI every five seconds. The &lt;code&gt;hashicorp/vault:2.1.1&lt;/code&gt; binary is about 500 MB and the sidecar has a 64Mi memory limit, so the binary could never stay in page cache and every exec re-read it from the NVMe: a sustained 17 to 28 MB/s read load, 24/7. I describe the HTTP polling version in the &lt;a href="https://dev.to/blog/vault-auto-unseal-polling-sidecar/"&gt;auto-unseal sidecar post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That removed the reads, but the host still showed about 16 MB/s of continuous writes coming from one k3s VM. &lt;code&gt;pidstat -d&lt;/code&gt; inside the VM put the top writer there, and it traced back to the Trivy Operator's scan jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Scan Jobs Were Doing
&lt;/h2&gt;

&lt;p&gt;They were not completing. They were retrying:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FATAL unable to initialize fs cache: cache may be in use by another process: timeout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The message says it plainly: the scan could not open Trivy's filesystem cache because another process held it, and it timed out waiting. The job failed and the operator ran the scan again. The expensive part is that every retry started from the beginning: download the Trivy DB, re-pull the target image's layers, then hit the same lock timeout. The operator paid the full I/O cost of a scan on every loop and got no report out of it.&lt;/p&gt;

&lt;p&gt;I didn't pin down which process was holding the cache when the jobs timed out. For the decision it didn't matter. A setup where a failed cache open means repeating all of the download work is unbounded by construction, and on this disk unbounded I/O does real damage.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Saturation Did to the Cluster
&lt;/h2&gt;

&lt;p&gt;The numbers from the host and the VM during the incident:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;iostat&lt;/code&gt; showed &lt;code&gt;w_await&lt;/code&gt; around 200 ms.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/proc/pressure/io&lt;/code&gt; showed &lt;code&gt;avg60&lt;/code&gt; above 8%.&lt;/li&gt;
&lt;li&gt;The k3s API server and one node's kubelet were timing out. Lease acquisition failed with &lt;code&gt;context deadline exceeded&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The kubelet lease failures were what actually triggered a mass container restart storm on that node. Nothing was wrong with those containers. The disk under them was busy re-downloading a vulnerability database.&lt;/p&gt;

&lt;h2&gt;
  
  
  This Was a Repeat
&lt;/h2&gt;

&lt;p&gt;The manifest already carried the history. In an earlier incident (REL-012c), catch-up scan storms after a node reboot pushed datastore latency on the control plane past its budget and contributed to API server outages. That led to two mitigations that are still in the file: a &lt;code&gt;trivy-scan&lt;/code&gt; PriorityClass with a value of &lt;code&gt;-1000000&lt;/code&gt;, so the scheduler evicts scan pods first under pressure, and a cap on concurrent scan jobs.&lt;/p&gt;

&lt;p&gt;On 2026-08-16 I also disabled SBOM generation (&lt;code&gt;OPERATOR_SBOM_GENERATION_ENABLED: "false"&lt;/code&gt;). The &lt;code&gt;SbomReport&lt;/code&gt; objects were 127 KB to 1.2 MB each, one per workload, and LIST calls on that CRD alone measured at a p99 of 4.98 s.&lt;/p&gt;

&lt;p&gt;Then on 2026-08-22 the host sat at a load of 25 to 40+ for the better part of an hour, I/O-bound with the NVMe queue saturated. The operator was respawning scan jobs across a backlog of 40+ app images. I scaled it to zero with &lt;code&gt;kubectl scale --replicas=0&lt;/code&gt;. It looked like it worked. ArgoCD's &lt;code&gt;selfHeal&lt;/code&gt; reverted it to &lt;code&gt;replicas: 1&lt;/code&gt; within one reconcile cycle, and the operator came back. PR #522 put &lt;code&gt;replicas: 0&lt;/code&gt; into Git instead, which held. Same day, I lowered &lt;code&gt;OPERATOR_CONCURRENT_SCAN_JOBS_LIMIT&lt;/code&gt; from 3 to 1.&lt;/p&gt;

&lt;p&gt;On 2026-10-09 (#863) I re-enabled it with one replica, reasoning that concurrency 1 plus no SBOMs would keep the I/O small. A week later it was the top writer on the host again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Concurrency Limit Never Bounded It
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;OPERATOR_CONCURRENT_SCAN_JOBS_LIMIT=1&lt;/code&gt; caps how many scan jobs run at the same time. It says nothing about how much I/O each job does. A single job still downloads a DB and extracts image layers, and a job that fails and retries does it again. Lowering the limit spread the same work over more time. It never limited the total, and with a retry loop the total has no ceiling.&lt;/p&gt;

&lt;p&gt;Scanning on a schedule instead of on every workload change would have helped, but in 0.33.0 that is an open upstream feature request (aquasecurity/trivy-operator#1696 and #744), not an option. Concurrency was the only knob, and the wrong one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix (#909, ADR-057)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Paused: scan jobs (per-scan trivy-DB download + image re-pull, retriggered
&lt;/span&gt;  &lt;span class="c1"&gt;# on every workload change) saturated the single DRAM-less NVMe and stalled
&lt;/span&gt;  &lt;span class="c1"&gt;# the API server. Trivy already runs on every PR in CI, so this is redundant.
&lt;/span&gt;  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Git, not via kubectl, for the same reason as in August. If you run &lt;a href="https://dev.to/blog/argocd-gitops-k3s-homelab/"&gt;ArgoCD with selfHeal&lt;/a&gt;, the manifest is the only place an emergency change can hold.&lt;/p&gt;

&lt;p&gt;The other half of the decision was accepting what I lose. What the operator adds is continuous rescanning of running images, which catches a CVE disclosed after an image has already shipped. Pausing it gives that up for as long as it stays paused. That is a real trade-off, not a free fix, and it only makes sense together with a plan for how image vulnerabilities get covered in the meantime. Pausing the operator was still the right call for the disk.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Verified It
&lt;/h2&gt;

&lt;p&gt;On the host, after the change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nvme0n1&lt;/code&gt; writes went from 19 to 1.1 MB/s.&lt;/li&gt;
&lt;li&gt;Host load went from 24 to 2.9.&lt;/li&gt;
&lt;li&gt;The top writer inside the VM was now the Minecraft server's JVM at about 0.65 MB/s, and Paper TPS was back to 20.0 / 19.8 / 19.7.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The host watchdog's load bar of 50 (ADR-056) now has real slack again.&lt;/p&gt;

&lt;p&gt;Two days later I deleted the stale report objects the operator had left behind, roughly 130 MB of datastore state (485 &lt;code&gt;configauditreports&lt;/code&gt; alone). One catch: my k3s runs on SQLite through kine, and the file does not shrink when rows are deleted. &lt;code&gt;state.db&lt;/code&gt; stayed at 289 MB and its WAL at 322 MB until a checkpoint and vacuum or a k3s restart, which I left for a maintenance window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before Re-enabling It
&lt;/h2&gt;

&lt;p&gt;The operator's ConfigMap and PriorityClass are still in place, so turning it back on is a one-line change. ADR-057 sets the condition: only with a bounded per-job I/O profile. That means a shared, durable cache that scan jobs reuse instead of rebuilding, throttled layer pulls, or a job-level I/O budget. Flipping &lt;code&gt;replicas&lt;/code&gt; back to 1 with the current setup would just rediscover the same wall a third time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Check on Your Own Cluster
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Search scan job logs for &lt;code&gt;cache may be in use by another process&lt;/code&gt;.&lt;/strong&gt; If it appears, your scans are retrying, and each retry may be repeating the full download.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure per-process disk writes, not just load.&lt;/strong&gt; &lt;code&gt;pidstat -d&lt;/code&gt; inside the VM found the writer. Host-level load only told me something was wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch I/O pressure.&lt;/strong&gt; &lt;code&gt;/proc/pressure/io&lt;/code&gt; and &lt;code&gt;w_await&lt;/code&gt; pointed at the disk. Kubernetes only showed lease timeouts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A concurrency limit is not an I/O limit.&lt;/strong&gt; It changes the shape of the load, not its size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pause through Git when ArgoCD has selfHeal.&lt;/strong&gt; &lt;code&gt;kubectl scale&lt;/code&gt; will be undone within one reconcile cycle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check what your CI scanner actually scans before calling the in-cluster one redundant.&lt;/strong&gt; In &lt;code&gt;trivy-action&lt;/code&gt;, &lt;code&gt;scan-type: config&lt;/code&gt; checks manifests and Terraform for misconfigurations, while &lt;code&gt;scan-type: image&lt;/code&gt; checks container images for CVEs. They are different jobs.&lt;/li&gt;
&lt;/ul&gt;



</description>
      <category>kubernetes</category>
      <category>security</category>
      <category>performance</category>
      <category>homelab</category>
    </item>
    <item>
      <title>Vault Goroutine Leak Silently Broke All 32 ExternalSecrets</title>
      <dc:creator>david</dc:creator>
      <pubDate>Sat, 28 Nov 2026 12:43:35 +0000</pubDate>
      <link>https://dev.to/dwoitzik/vault-goroutine-leak-silently-broke-all-32-externalsecrets-1pmi</link>
      <guid>https://dev.to/dwoitzik/vault-goroutine-leak-silently-broke-all-32-externalsecrets-1pmi</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/vault-goroutine-leak-externalsecrets-silent-failure/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For about 20 days, every one of the 32 &lt;code&gt;ExternalSecret&lt;/code&gt; objects in my k3s cluster reported &lt;code&gt;SecretSyncedError&lt;/code&gt;, and &lt;code&gt;vault-0&lt;/code&gt; sat at &lt;code&gt;0/1&lt;/code&gt; Ready. Nothing alerted, no app broke, and I only found it on 2026-09-30 while chasing an unrelated alert. The cause was two faults stacked together: Vault's Kubernetes service registration had no RBAC, so it retried a 403 every five seconds, and each retry leaked a goroutine until the server stopped answering on port 8200. A pod restart plus a namespaced Role fixed it. The missing alert took another five weeks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Looked Like
&lt;/h2&gt;

&lt;p&gt;Every ExternalSecret showed the same condition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ready: SecretSyncedError - could not get secret data from provider
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When all 32 fail at once, the individual secrets are not the problem. The provider is. My setup is the one described in &lt;a href="https://dev.to/blog/external-secrets-operator-vault-kubernetes/"&gt;External Secrets Operator + HashiCorp Vault&lt;/a&gt;: one &lt;code&gt;ClusterSecretStore&lt;/code&gt; pointing at a single standalone Vault pod, &lt;code&gt;vault-0&lt;/code&gt;, with raft storage on a &lt;code&gt;local-path&lt;/code&gt; PVC.&lt;/p&gt;

&lt;p&gt;The "20 days" figure is not a guess from logs. It comes from Prometheus, &lt;code&gt;kube_pod_status_ready&lt;/code&gt; for &lt;code&gt;vault/vault-0&lt;/code&gt;, which shows the pod dropping out of Ready and never coming back.&lt;/p&gt;

&lt;p&gt;The uncomfortable part: Prometheus knew. &lt;code&gt;KubeStatefulSetReplicasMismatch&lt;/code&gt; and &lt;code&gt;KubePodNotReady&lt;/code&gt; both fired for the whole window. So did &lt;code&gt;KubeJobFailed&lt;/code&gt; and &lt;code&gt;TargetDown&lt;/code&gt;, for unrelated reasons, and had been for long enough that I had stopped reading any of them as incidents. The Vault signal was in the pile with the noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wedged, Not Sealed
&lt;/h2&gt;

&lt;p&gt;A sealed Vault is the usual failure after a restart, and it is what the &lt;a href="https://dev.to/blog/vault-auto-unseal-polling-sidecar/"&gt;polling unseal sidecar&lt;/a&gt; exists to handle. This was different. Vault was wedged, not merely sealed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The process was alive, with 5h50m of accumulated CPU time.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;data-vault-0&lt;/code&gt; PVC was &lt;code&gt;Bound&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wget&lt;/code&gt; and &lt;code&gt;vault status&lt;/code&gt; against the pod &lt;strong&gt;timed out&lt;/strong&gt;. They were not refused.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point narrows things down. A refused connection means nothing holds the port. A timeout means something still does, but the process behind it never gets around to answering. Vault was alive and holding its listener, yet too busy with something else to serve. So I sent the Vault process a &lt;code&gt;SIGQUIT&lt;/code&gt;, which makes the Go runtime dump every goroutine's stack before exiting.&lt;/p&gt;

&lt;p&gt;The dump had over 160,000 goroutines. Every one was parked in &lt;code&gt;[select, 29459 minutes]&lt;/code&gt;, which is 20.5 days, and every one had been spawned from the same function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;serviceregistration&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That matched the Prometheus readiness timeline almost to the day.&lt;/p&gt;

&lt;p&gt;One note on my own evidence from that night: I also checked &lt;code&gt;/proc/net/tcp&lt;/code&gt; for port 8200 and wrote down that there was no entry. The check looked for &lt;code&gt;0x2014&lt;/code&gt;, which is port 8212. Port 8200 is &lt;code&gt;0x2008&lt;/code&gt;. That observation proves nothing either way, so this post doesn't rely on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Service Registration Was Retrying
&lt;/h2&gt;

&lt;p&gt;Vault's standalone config in &lt;code&gt;kubernetes/system/vault/application.yml&lt;/code&gt; enables Kubernetes service registration with an empty block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="s2"&gt;"raft"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/vault/data"&lt;/span&gt;
  &lt;span class="n"&gt;node_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"vault-0"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;service_registration&lt;/span&gt; &lt;span class="s2"&gt;"kubernetes"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With service registration on, Vault keeps labels on its own pod (&lt;code&gt;vault-sealed&lt;/code&gt;, &lt;code&gt;vault-active&lt;/code&gt;, &lt;code&gt;vault-initialized&lt;/code&gt; and so on) so a Service selector can route to the active node. To do that it has to read and patch its own pod object. The &lt;a href="https://developer.hashicorp.com/vault/docs/configuration/service-registration/kubernetes" rel="noopener noreferrer"&gt;Vault docs&lt;/a&gt; say the ServiceAccount needs &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt; and &lt;code&gt;patch&lt;/code&gt; on &lt;code&gt;pods&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The chart did not grant it. The only binding it created for the &lt;code&gt;vault&lt;/code&gt; ServiceAccount was &lt;code&gt;system:auth-delegator&lt;/code&gt;, which covers &lt;code&gt;tokenreviews&lt;/code&gt; and &lt;code&gt;subjectaccessreviews&lt;/code&gt; and nothing about pods. So every attempt failed, and the log carried this line every five seconds for the life of the process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;service_registration.kubernetes: unable to set initial state due to GET .../namespaces/vault/pods/vault-0 giving up after 1 attempt(s): bad status code ... 403, will retry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 403 on its own is a harmless, noisy log line. The leak is what turned it into an outage: each failed retry left a goroutine behind in &lt;code&gt;(*Client).do&lt;/code&gt;, nothing ever released them, and after 20 days the process could no longer serve its listener. Fault 2 (no RBAC) is what made fault 1 (the leak) unbounded.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Restart, Then RBAC
&lt;/h2&gt;

&lt;p&gt;I fixed both halves, not only the visible one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Restart the wedged pod.&lt;/strong&gt; I snapshotted VM 211 first (&lt;code&gt;vault-hang-pre-snapshot&lt;/code&gt;), then deleted the pod. No data was touched; the raft store lives on &lt;code&gt;data-vault-0&lt;/code&gt;. Vault came back &lt;code&gt;sealed: false&lt;/code&gt; within 10 seconds, unsealed by the existing sidecar without help. That was the check that mattered: the sidecar recovered a real wedge with no manual step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grant the RBAC.&lt;/strong&gt; PR #804 added &lt;code&gt;kubernetes/system/vault/rbac.yml&lt;/code&gt; and put it in the &lt;code&gt;vault-manifests&lt;/code&gt; ArgoCD Application's include list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;include&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{unseal,network-policies,certificate,rbac}.yml"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first version only granted &lt;code&gt;get, list, watch&lt;/code&gt; on pods. GETs stopped returning 403, but Vault also PATCHes its pod to set those labels, so the PATCHes kept failing. PR #805 eight minutes later added &lt;code&gt;update&lt;/code&gt; and &lt;code&gt;patch&lt;/code&gt;. The final Role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Role&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault-server&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault&lt;/span&gt;
&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"pods"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"get"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"list"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"watch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"update"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"patch"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"endpoints"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"services"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pods/exec"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"get"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"list"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"watch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"create"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"update"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"patch"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nn"&gt;---
&lt;/span&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RoleBinding&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault-server&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault&lt;/span&gt;
&lt;span class="na"&gt;subjects&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault&lt;/span&gt;
&lt;span class="na"&gt;roleRef&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;apiGroup&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Role&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vault-server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a namespaced Role on purpose, not a ClusterRole. The only object this feature needs is Vault's own pod, so the grant stays inside the &lt;code&gt;vault&lt;/code&gt; namespace. Trivy later flagged two checks on this file (KSV-0053 and KSV-0056). Both grants are documented requirements here, so they are suppressed in &lt;code&gt;.trivyignore&lt;/code&gt; with a comment saying why.&lt;/p&gt;

&lt;p&gt;Verification was against the running system, not the pod status: all 32 ExternalSecrets went back to &lt;code&gt;Ready=True&lt;/code&gt;, and the 403 line stopped appearing in &lt;code&gt;vault-0&lt;/code&gt;'s logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Nothing Broke for 20 Days
&lt;/h2&gt;

&lt;p&gt;ESO does not delete a target Secret when the provider fails. It just stops updating it. Every workload kept reading the last Secret that had synced before Vault wedged, so from the outside everything was fine.&lt;/p&gt;

&lt;p&gt;That was luck. Any credential rotation in that window would never have reached the cluster, and anything that needed ESO to create a Secret from scratch (a new app, a recreated namespace) would have failed. A failing secret store with stale-but-valid Secrets is the worst kind of failure to have: the system degrades in a way that only shows up on the next change.&lt;/p&gt;

&lt;p&gt;The memory limit is a second piece of luck. An earlier incident had already pushed &lt;code&gt;vault-0&lt;/code&gt;'s limit from 512Mi to 1Gi (the comment is still in &lt;code&gt;application.yml&lt;/code&gt;). At the time of the wedge the container was sitting at 1022Mi. The limit was the only thing still containing the leak, and the memory graph had been climbing long before the listener died.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Alert I Wrote Down and Then Didn't Add
&lt;/h2&gt;

&lt;p&gt;ADR-046 ended with "Follow-up not done here: an alert on ExternalSecret Ready != 1." That line sat there for five weeks.&lt;/p&gt;

&lt;p&gt;On 2026-10-31 every ExternalSecret failed again, for an unrelated reason: an egress default-deny for the &lt;code&gt;external-secrets&lt;/code&gt; namespace, applied by hand, whose Vault allow rule targeted a node IP instead of the Vault pod. Same symptom, same silence, workloads running on stale Secrets. It was fixed on 2026-11-04.&lt;/p&gt;

&lt;p&gt;Writing the alert then exposed a second gap. The metric name I had noted in the ADR was not the one ESO exports, and it did not matter anyway: ESO's ServiceMonitors lacked the &lt;code&gt;release: kube-prometheus-stack&lt;/code&gt; label, so Prometheus never selected them and no ESO metric existed at all. PR #1010 added the label in the ESO Helm values and then the alert in &lt;code&gt;silent-failure-alerts.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ExternalSecretNotSyncing&lt;/span&gt;
  &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;externalsecret_status_condition{condition="Ready", status="False"} == 1&lt;/span&gt;
  &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;30m&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;critical&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ExternalSecretsMetricsMissing&lt;/span&gt;
  &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;absent(externalsecret_status_condition)&lt;/span&gt;
  &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;30m&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;warning&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second rule is there because the first can only fire while ESO is being scraped. Without it, a missing ServiceMonitor label puts you right back where I was: an alert that looks like coverage and can never fire.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Check Now
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;All ExternalSecrets failing together means the store, not the secrets.&lt;/strong&gt; First command: &lt;code&gt;kubectl get clustersecretstore vault -o jsonpath='{.status.conditions}'&lt;/code&gt;. The alert annotation says the same thing, so I don't have to remember it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A timeout from a live process is a different bug from a refused connection.&lt;/strong&gt; If the PID is alive and the port is gone, get a goroutine dump (&lt;code&gt;SIGQUIT&lt;/code&gt; for any Go binary) before restarting. The restart destroys the evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read RBAC requirements for every optional Vault stanza.&lt;/strong&gt; &lt;code&gt;service_registration "kubernetes" {}&lt;/code&gt; looks like a no-op config line. It is a permanent API client that needs pod patch rights.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A follow-up in an ADR is not a fix.&lt;/strong&gt; The alert that would have caught the second outage was written down in the first one's ADR. What I'd do differently: ship the detection in the same PR as the fix, because the follow-up list is where it stalled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every new alert needs a "metrics present" partner.&lt;/strong&gt; &lt;code&gt;absent()&lt;/code&gt; on the series the alert depends on, so a broken scrape config fails loudly instead of making the alert silent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Noisy alerts cost more than their own noise.&lt;/strong&gt; &lt;code&gt;KubePodNotReady&lt;/code&gt; for &lt;code&gt;vault-0&lt;/code&gt; fired for 20 days and I ignored it because it sat next to alerts I had learned to ignore. Fixing or silencing the chronic ones is what makes the real ones readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The timeout-versus-refused distinction is the part I'd have recognized sooner with more distributed-systems background. &lt;a href="https://dev.to/go/4aUtkCs"&gt;Designing Data-Intensive Applications*&lt;/a&gt; has a good chapter on exactly that: a remote node that does not respond tells you very little about whether it is dead, slow or stuck.&lt;/p&gt;



</description>
      <category>kubernetes</category>
      <category>vault</category>
      <category>debugging</category>
      <category>homelab</category>
    </item>
    <item>
      <title>A tmpfs Download Folder Took Down My Proxmox LXC: tmpfs Counts Against the Memory Cgroup</title>
      <dc:creator>david</dc:creator>
      <pubDate>Wed, 25 Nov 2026 18:04:16 +0000</pubDate>
      <link>https://dev.to/dwoitzik/a-tmpfs-download-folder-took-down-my-proxmox-lxc-tmpfs-counts-against-the-memory-cgroup-2iin</link>
      <guid>https://dev.to/dwoitzik/a-tmpfs-download-folder-took-down-my-proxmox-lxc-tmpfs-counts-against-the-memory-cgroup-2iin</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/tmpfs-lxc-memory-cgroup-sabnzbd/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I moved SABnzbd's incomplete-download folder onto a 20 GB tmpfs to get unpacking off a slow disk. The container it served had a 4 GB memory limit. The first large download after the change, an 8.9 GB Blu-ray rip, caused about 8 million &lt;code&gt;memory.high&lt;/code&gt; throttle events, parked roughly 130 threads in uninterruptible sleep and pushed the Proxmox host's load to around 150. Nothing ran out of memory and the job finished. The cause: tmpfs pages are charged to the memory cgroup of whoever writes them, so the ramdisk was eating the container's own 4 GB budget. Three weeks later the ramdisk went away again, for a different reason.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Folder Was on a Ramdisk at All
&lt;/h2&gt;

&lt;p&gt;SABnzbd runs in &lt;code&gt;ct-srv-media-acq-01&lt;/code&gt; (LXC 202) alongside the &lt;em&gt;arr apps, the setup described in &lt;a href="https://dev.to/blog/media-stack-two-containers-python-cronjob/"&gt;My Media Stack Lives in Two Containers and a Python CronJob&lt;/a&gt;. It writes every download into an *incomplete&lt;/em&gt; directory while fetching, verifying and unpacking, then moves the result to the library. That directory is pure scratch. Its contents are worthless the moment a job completes or fails.&lt;/p&gt;

&lt;p&gt;It had already moved twice for I/O reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Off the root SSD pool.&lt;/strong&gt; SABnzbd's high-rate writes competed with the k3s VM disks on the same pool and caused a real k3s crash (REL-020 in my repo).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Onto the archive HDD&lt;/strong&gt;, a &lt;a href="https://dev.to/go/4vxwLpY"&gt;Seagate Expansion 2TB external drive*&lt;/a&gt;. That protected the cluster, but parallel download, verify and unpack thrashed a spinning disk that also serves the media library. Unpack throughput sat around 5 MB/s.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So on 2026-10-19, ADR-066 put the incomplete directory on a host tmpfs at &lt;code&gt;/mnt/sab-incomplete&lt;/code&gt;, bind-mounted into the LXC at &lt;code&gt;/downloads/incomplete&lt;/code&gt;. The mount lives in &lt;code&gt;/etc/fstab&lt;/code&gt;, managed by the &lt;code&gt;pve_host_mounts&lt;/code&gt; Ansible role. The first version used &lt;code&gt;size=20G&lt;/code&gt;. The container stayed at its existing 4 GB limit. The draft ADR even said tmpfs pressure would be absorbed by the host's RAM. That sentence was wrong, and the next day proved it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Incident Looked Like
&lt;/h2&gt;

&lt;p&gt;One 8.9 GB Blu-ray rip went into the tmpfs. Its pages filled well past the container's 4 GB limit, and the host stalled:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;about 8 million &lt;code&gt;memory.high&lt;/code&gt; throttle events for the container&lt;/li&gt;
&lt;li&gt;roughly 130 threads in uninterruptible sleep, all in &lt;code&gt;folio_wait_bit_common&lt;/code&gt; called from &lt;code&gt;filemap_fault&lt;/code&gt; on those tmpfs pages&lt;/li&gt;
&lt;li&gt;host load near 150&lt;/li&gt;
&lt;li&gt;the container's &lt;code&gt;memory.pressure&lt;/code&gt; reporting &lt;code&gt;full avg10=14.36&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The stuck threads were the whole media stack plus Enshrouded's game process, which runs on the same host and competed for the same reclaim.&lt;/p&gt;

&lt;p&gt;What did &lt;em&gt;not&lt;/em&gt; happen matters as much. No OOM kill was recorded. Nothing was out of memory in the sense the OOM killer cares about. The download completed. The host was simply busy servicing reclaim inside one cgroup, and every process touching those pages waited on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause: tmpfs Is shmem, and shmem Has an Owner
&lt;/h2&gt;

&lt;p&gt;tmpfs pages are shared memory (shmem). The kernel charges shmem to the memory cgroup of the process that writes it. In this case that was SABnzbd inside LXC 202, so every byte in the ramdisk counted against LXC 202's limit, not against the host's free pool.&lt;/p&gt;

&lt;p&gt;The host had plenty of RAM. That did not help, because the container could not use it. Once the 4 GB budget was gone, the kernel's response was not "evict some host page cache". It was "reclaim inside this cgroup, then throttle". tmpfs pages cannot simply be dropped like file cache, because there is no backing file to re-read them from. At best they go to swap. With a 20 GB ramdisk behind a 4 GB limit, the container was permanently in reclaim.&lt;/p&gt;

&lt;p&gt;A ramdisk does not give a container free memory. It spends the container's own memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix (2026-10-20)
&lt;/h2&gt;

&lt;p&gt;Two numbers changed, and they are coupled. The tmpfs cap went from 20 GB to 10 GB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pve_host_mounts_list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/mnt/sab-incomplete&lt;/span&gt;
    &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tmpfs&lt;/span&gt;
    &lt;span class="na"&gt;fstype&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tmpfs&lt;/span&gt;
    &lt;span class="na"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"size=10G,mode=0755,nosuid,nodev,nofail"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The container's limit went up to 12 GB plus 4 GB swap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;  &lt;span class="c1"&gt;# Sized against the 10G host tmpfs at /mnt/sab-incomplete: ramdisk pages are&lt;/span&gt;
  &lt;span class="c1"&gt;# charged to this container's cgroup, so the limit must clear the ramdisk plus&lt;/span&gt;
  &lt;span class="c1"&gt;# ~2G of stack usage, or SABnzbd throttles in reclaim. See ADR-066.&lt;/span&gt;
  &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;dedicated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12288&lt;/span&gt;
    &lt;span class="n"&gt;swap&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Raising the container to 12 GB and capping the ramdisk at 10 GB cleared the stall immediately. On that sizing the same 8.9 GB job unpacked in 151 s, about 59 MB/s, now bound by the HDD's sequential write into the complete directory rather than by the read out of RAM.&lt;/p&gt;

&lt;p&gt;The rule I wrote into the ADR:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The tmpfs cap must be strictly below the container's memory limit.&lt;/strong&gt; The gap is the stack's own anonymous and page-cache usage, about 2 GB measured here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tmpfs cap is also the maximum size of any single in-flight download.&lt;/strong&gt; A larger job stalls at the cap.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One more detail, found only on 2026-11-12: the Terraform &lt;code&gt;memory&lt;/code&gt; block above landed in the wrong resource. It went into &lt;code&gt;ct_srv_docker_01&lt;/code&gt; instead of &lt;code&gt;ct_srv_media_acq_01&lt;/code&gt;. It surfaced while I was reconciling the Proxmox stack against the live host (#1091), and &lt;code&gt;ct-srv-docker-01&lt;/code&gt; went back to its real 6 GB. Read the resource name around every hunk in a plan, not only the values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Ramdisk Lasted Three Weeks
&lt;/h2&gt;

&lt;p&gt;Rule 2 was a deliberate trade, and the ADR said so: "a ramdisk big enough for an arbitrary 4K remux does not exist on a 62 GB host."&lt;/p&gt;

&lt;p&gt;Radarr's quality profile did not respect it. It allowed 2160p Remux and 2160p Bluray releases of 50 to 80 GB. Such a job fills the 10 GB tmpfs, and SABnzbd pauses itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Too little diskspace forcing PAUSE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;fulldisk_autoresume = 0&lt;/code&gt;, the default, it never resumes. Aborted unpacks left &lt;code&gt;_UNPACK_*&lt;/code&gt; folders behind. On 2026-11-11 I found about 27 GB of them, and the queue needed manual intervention.&lt;/p&gt;

&lt;p&gt;The obvious move would have been 1080p only. The TV is 4K with Dolby Vision and HDR10+, and the visible gain of a 2160p release is HDR, which 1080p releases almost never carry. What does not pay off here is Remux: bit-exact video and lossless audio at three to four times the size of a good encode, on a pool with about 240 GB free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Back to the HDD, with a USB 3 Port This Time
&lt;/h2&gt;

&lt;p&gt;ADR-073 (#1071) moved the incomplete directory back to the archive HDD, as a ZFS dataset mounted at the same host path, so the container's bind mount did not change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pve_host_mounts_list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;pve_host_mounts_absent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/mnt/sab-incomplete&lt;/span&gt;

&lt;span class="na"&gt;pve_host_mounts_datasets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;archive/sab-incomplete&lt;/span&gt;
    &lt;span class="na"&gt;mountpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/mnt/sab-incomplete&lt;/span&gt;
    &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"101000"&lt;/span&gt;
    &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"101000"&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0777"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;101000&lt;/code&gt; is the host-side UID of container UID 1000 in an unprivileged LXC. The role first unmounts the old tmpfs and removes it from fstab, then creates the dataset.&lt;/p&gt;

&lt;p&gt;What made the HDD acceptable again was a cable. When the 5 MB/s unpack numbers were measured, the disk was on a USB 2 port. My hardware notes now record about 60 MB/s read on USB 3 against 3 to 13 MB/s on USB 2 for the same drive. The original reason for the ramdisk was mostly a port.&lt;/p&gt;

&lt;p&gt;The same day, #1070 changed what gets downloaded so the pipeline can always finish it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Radarr's profile allows WEB 2160p, Bluray-2160p, WEB 1080p and Bluray-1080p, never Remux.&lt;/li&gt;
&lt;li&gt;2160p is capped at 220 MB per minute of runtime (about 26 GB for two hours), 1080p at 50.&lt;/li&gt;
&lt;li&gt;Radarr refuses imports below 100 GB free on &lt;code&gt;/media&lt;/code&gt;, so 4K cannot fill the pool shared with backups.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fulldisk_autoresume&lt;/code&gt; is set to &lt;code&gt;1&lt;/code&gt; through SABnzbd's API from Ansible:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Let SABnzbd resume on its own after a full-disk pause&lt;/span&gt;
  &lt;span class="na"&gt;ansible.builtin.uri&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"http://localhost:8080/api?mode=set_config&amp;amp;section=misc&amp;amp;keyword=fulldisk_autoresume&amp;amp;value=1&amp;amp;output=json&amp;amp;apikey={{ media_acquisition_sabnzbd_api_key }}"&lt;/span&gt;
  &lt;span class="na"&gt;when&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;(media_acquisition_sab_misc.json.config.misc.fulldisk_autoresume | int) != 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the scratch off RAM, LXC 202 no longer needs the 12 GB reservation. It is back at 4096 MB in code, with a comment that the stack itself uses about 1 GB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist If You Want a Ramdisk in a Container
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;tmpfs written from inside a container is charged to that container.&lt;/strong&gt; Size the container's memory limit above the tmpfs cap plus the workload's own usage. Host free memory is irrelevant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No OOM does not mean no memory problem.&lt;/strong&gt; Look at &lt;code&gt;memory.pressure&lt;/code&gt; and &lt;code&gt;memory.events&lt;/code&gt; (&lt;code&gt;high&lt;/code&gt; counter) in the container's cgroup. A climbing &lt;code&gt;high&lt;/code&gt; count with threads in D state on &lt;code&gt;filemap_fault&lt;/code&gt; is reclaim, not a disk problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tmpfs size is a per-job ceiling.&lt;/strong&gt; If anything upstream can produce a job larger than the cap, it will stall. Enforce the limit where the job is chosen (here: Radarr size caps), not only where it lands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn on auto-resume for full-disk pauses.&lt;/strong&gt; &lt;code&gt;fulldisk_autoresume = 0&lt;/code&gt; turns one full disk into a queue that stays paused until a human looks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the USB port before redesigning storage.&lt;/strong&gt; A USB 2 port turned a usable HDD into a 5 MB/s bottleneck, and I built a ramdisk around it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the resource name in every Terraform hunk.&lt;/strong&gt; A correct value in the wrong block applies cleanly and fixes nothing in code.&lt;/li&gt;
&lt;/ul&gt;



</description>
      <category>proxmox</category>
      <category>homelab</category>
      <category>debugging</category>
      <category>storage</category>
    </item>
    <item>
      <title>Homelab Black Friday 2026: A Checklist, Not a Deal Feed</title>
      <dc:creator>david</dc:creator>
      <pubDate>Wed, 25 Nov 2026 18:03:41 +0000</pubDate>
      <link>https://dev.to/dwoitzik/homelab-black-friday-2026-a-checklist-not-a-deal-feed-4l26</link>
      <guid>https://dev.to/dwoitzik/homelab-black-friday-2026-a-checklist-not-a-deal-feed-4l26</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/homelab-black-friday-2026/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Black Friday 2026 falls on 27 November, with Cyber Monday on 30 November. Every year the same pattern appears: a wall of "deals" posts, most of them generated from an affiliate feed, many of them listing products the author has never touched. I am not going to pretend I know which homelab products will be discounted this year. I do not. What I can do is show the checks I use before buying anything for my own rack.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Discount Badge Is Not the Deal
&lt;/h2&gt;

&lt;p&gt;A struck-through price is a claim, not evidence. Retailers can raise a list price before a sale and then "discount" it back to the normal price. The only number that matters is what the product actually sold for over the last few weeks.&lt;/p&gt;

&lt;p&gt;Before buying, check the price history:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CamelCamelCamel&lt;/strong&gt; and &lt;strong&gt;Keepa&lt;/strong&gt; track Amazon price history. Look at the 30-day and 90-day range, not the percentage on the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The current price versus the usual price.&lt;/strong&gt; If the sale price is within a few euros of the normal range, it is not a deal; it is a normal day with a red badge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The seller.&lt;/strong&gt; "Sold by Amazon" and a third-party marketplace seller are not the same purchase. Check who ships it and who handles the return.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The exact configuration.&lt;/strong&gt; A cheap listing often swaps the RAM, SSD or CPU generation without changing the product name. That is how a 16GB model becomes a "discount" on a 32GB claim.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Rule: Buy the Project, Not the Discount
&lt;/h2&gt;

&lt;p&gt;The most expensive homelab purchase is the one you did not plan for. A discount on a device you do not need is still money spent, and it takes rack space, power and attention after the sale ends.&lt;/p&gt;

&lt;p&gt;I use one test before buying: &lt;strong&gt;does this replace something broken, or does it complete a project that is already planned?&lt;/strong&gt; If the answer is no, the discount is irrelevant.&lt;/p&gt;

&lt;p&gt;That rule eliminates most of the temptation. It also means the useful Black Friday list is short.&lt;/p&gt;

&lt;h2&gt;
  
  
  If You Already Know What You Need
&lt;/h2&gt;

&lt;p&gt;This is the gear I run myself. I am not claiming any of it will be discounted. I am saying that if it is on your list anyway, these are the versions I would check first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backup Target
&lt;/h3&gt;

&lt;p&gt;A &lt;a href="https://dev.to/go/4vxwLpY"&gt;Seagate Portable 2TB External HDD*&lt;/a&gt; is the least exciting purchase on this page and the one most likely to save you. It is my directly attached backup target, not a complete 3-2-1 strategy. If you do not have a backup target yet, buy this before any compute upgrade.&lt;/p&gt;

&lt;p&gt;Read the &lt;a href="https://dev.to/blog/backup-restore-test-never-verified-network-conflict/"&gt;backup restore test writeup&lt;/a&gt; before you trust it with data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory for an Existing Mini PC
&lt;/h3&gt;

&lt;p&gt;If containers are getting OOM-killed, check memory before buying a new machine. I upgraded my node with a &lt;a href="https://dev.to/go/3QZejZn"&gt;Crucial 64GB DDR4 SODIMM Kit*&lt;/a&gt;. Match the generation exactly: DDR4 and DDR5 are not interchangeable.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://dev.to/blog/k3s-cascading-failure-oomkill-dns-storm/"&gt;k3s OOM cascade article&lt;/a&gt; is the long version of why this upgrade mattered in my lab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cooling and Cable Management
&lt;/h3&gt;

&lt;p&gt;A closed rack traps heat. I added &lt;a href="https://dev.to/go/44vgXJy"&gt;ARCTIC P12 120mm Fans*&lt;/a&gt; as exhaust after watching an NVMe drive hit 72°C in summer. That is a real measurement from my rack, not a benchmark from a product page.&lt;/p&gt;

&lt;p&gt;For cables, &lt;a href="https://dev.to/go/4bnvY3K"&gt;Velcro cable ties*&lt;/a&gt; beat zip ties because the rack changes. Both are small purchases that are easy to justify if you already have the rack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://dev.to/go/4wKbVEW"&gt;iFixit Pro Tech Toolkit*&lt;/a&gt; is the tool kit I reach for when opening a mini PC or swapping an M.2 drive. The &lt;a href="https://dev.to/go/4wcr4PG"&gt;Brother PT-H110 Label Maker*&lt;/a&gt; is the one I would buy before building a rack, not after.&lt;/p&gt;

&lt;h3&gt;
  
  
  Network Gear
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://dev.to/go/4w08b21"&gt;MikroTik RB5009*&lt;/a&gt; is my core router. It is a bad impulse buy: RouterOS is not a consumer interface, and it only makes sense if you already plan to manage the network as code. Read the &lt;a href="https://dev.to/blog/mikrotik-vs-ubiquiti-home-network-2026/"&gt;MikroTik vs Ubiquiti comparison&lt;/a&gt; before choosing an ecosystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Books
&lt;/h3&gt;

&lt;p&gt;Books do not go stale like hardware listings. &lt;a href="https://dev.to/go/4aUtkCs"&gt;Designing Data-Intensive Applications*&lt;/a&gt;, &lt;a href="https://dev.to/go/4f4RHQf"&gt;The Phoenix Project*&lt;/a&gt;, &lt;a href="https://dev.to/go/4gEAhv9"&gt;The Linux Command Line*&lt;/a&gt; and &lt;a href="https://dev.to/go/4f3kTar"&gt;Netzwerke: Verstehen, Einrichten, Administrieren*&lt;/a&gt; are the four I recommend most often.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Would Skip
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A second compute node without a plan.&lt;/strong&gt; Two nodes without clustering or a specific workload are just two machines to patch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A 19-inch rack for a first homelab.&lt;/strong&gt; Check the &lt;a href="https://dev.to/blog/homelab-hardware-tour-physical-rack/"&gt;hardware tour&lt;/a&gt; for why I chose 10-inch instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A "deal" on a discontinued model.&lt;/strong&gt; The Beelink EQ12 is the example I keep using because it was recommended here before it disappeared from amazon.de. A discount on hardware you cannot buy replacement parts for is not a bargain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anything with a subscription attached.&lt;/strong&gt; A discounted device that requires a monthly service is a bill with a welcome offer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Shorter Version
&lt;/h2&gt;

&lt;p&gt;If you are shopping for someone else, the &lt;a href="https://dev.to/blog/homelab-gift-guide-2026/"&gt;homelab gift guide&lt;/a&gt; is organized by what they already own, not by discount percentage. If you are shopping for yourself, write the project down first, then check the price history. The sale is only useful if the project was already real.&lt;/p&gt;

&lt;p&gt;I will not be updating this page with a live deal feed. A page that claims to track prices in real time is usually tracking clicks.&lt;/p&gt;

</description>
      <category>hardware</category>
      <category>homelab</category>
      <category>review</category>
    </item>
    <item>
      <title>cert-manager Cloudflare DNS-01: Cleanup Fails with Error 7003</title>
      <dc:creator>david</dc:creator>
      <pubDate>Mon, 23 Nov 2026 19:29:26 +0000</pubDate>
      <link>https://dev.to/dwoitzik/cert-manager-cloudflare-dns-01-cleanup-fails-with-error-7003-mg1</link>
      <guid>https://dev.to/dwoitzik/cert-manager-cloudflare-dns-01-cleanup-fails-with-error-7003-mg1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/cert-manager-cloudflare-dns01-error-7003-cleanup/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My wildcard certificate for &lt;code&gt;*.woitzik.dev&lt;/code&gt; was about a week from expiry when I found out that cert-manager could pass a Cloudflare DNS-01 challenge and still never finish the order. The challenge validated. The cleanup step that deletes the &lt;code&gt;_acme-challenge&lt;/code&gt; TXT record then failed with Cloudflare error 7003 on &lt;code&gt;DELETE /zones//dns_records/&amp;lt;id&amp;gt;&lt;/code&gt;: an empty zone ID in the URL. I was running cert-manager v1.14.4, which builds that URL from a field Cloudflare no longer returns. Upgrading to v1.19.6 fixed it, and the renewal completed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;One &lt;code&gt;Certificate&lt;/code&gt; in &lt;code&gt;kube-system&lt;/code&gt; covers every service behind Traefik. I described the full setup in &lt;a href="https://dev.to/blog/cert-manager-wildcard-k3s-cloudflare/"&gt;wildcard TLS on k3s with cert-manager and Cloudflare DNS01&lt;/a&gt;. The part that matters here is the list of names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cert-manager.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Certificate&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wildcard-woitzik-dev&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-system&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secretName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wildcard-woitzik-dev-tls&lt;/span&gt;
  &lt;span class="na"&gt;issuerRef&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;letsencrypt-production&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterIssuer&lt;/span&gt;
  &lt;span class="na"&gt;commonName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"*.woitzik.dev"&lt;/span&gt;
  &lt;span class="na"&gt;dnsNames&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"*.woitzik.dev"&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"woitzik.dev"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two names, one for the wildcard and one for the apex. Both are validated with a TXT record at the same name, &lt;code&gt;_acme-challenge.woitzik.dev&lt;/code&gt;. That detail turns one failed cleanup into a stuck order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Renewal Had Already Been Stuck for Weeks
&lt;/h2&gt;

&lt;p&gt;The 7003 error was the second problem, not the first. The renewal had been failing since 2026-10-12, and the first cause was my own NetworkPolicy. cert-manager runs with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;extraArgs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--dns01-recursive-nameservers=1.1.1.1:53,8.8.8.8:53&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--dns01-recursive-nameservers-only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So its propagation check talks to &lt;code&gt;1.1.1.1&lt;/code&gt; and &lt;code&gt;8.8.8.8&lt;/code&gt; directly. The egress policy for the &lt;code&gt;cert-manager&lt;/code&gt; namespace only allowed TCP 443 to the internet, and the challenge sat pending with &lt;code&gt;read udp ...-&amp;gt;8.8.8.8:53: connection refused&lt;/code&gt;. The fix (#1016, 2026-11-04) added port 53 to exactly those two resolvers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;    &lt;span class="c1"&gt;# DNS-01 propagation checks query the --dns01-recursive-nameservers set in
&lt;/span&gt;    &lt;span class="c1"&gt;# cert-manager/application.yml directly; keep both lists in sync.
&lt;/span&gt;    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;ipBlock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cidr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1.1.1.1/32&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;ipBlock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cidr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;8.8.8.8/32&lt;/span&gt;
      &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;UDP&lt;/span&gt;
          &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;53&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TCP&lt;/span&gt;
          &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;53&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With DNS reachable, the propagation check passed and the wildcard challenge validated. The certificate still did not renew.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Symptom: Challenge Valid, Order Never Completes
&lt;/h2&gt;

&lt;p&gt;Looking at the &lt;code&gt;Challenge&lt;/code&gt; resources showed the next failure. The wildcard challenge had validated, but cert-manager could not clean it up. The Cloudflare API rejected the delete:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE /zones//dns_records/&amp;lt;id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;with error code 7003. Note the double slash. The zone ID between &lt;code&gt;zones/&lt;/code&gt; and &lt;code&gt;/dns_records&lt;/code&gt; is empty.&lt;/p&gt;

&lt;p&gt;The apex challenge was the one left waiting. It needs its own TXT value at &lt;code&gt;_acme-challenge.woitzik.dev&lt;/code&gt;, the same name the wildcard challenge had used, and it waited on the cleanup that kept failing. The order needs both challenges, so it never completed. Meanwhile the old certificate stayed &lt;code&gt;Ready=True&lt;/code&gt;, because it was still valid. Nothing looked broken until the expiry date got close.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get challenges,orders -n kube-system
kubectl describe challenge -n kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those two commands are where this shows up. The &lt;code&gt;Certificate&lt;/code&gt; itself only tells you that it is not renewing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause: Cloudflare Stopped Returning zone_id
&lt;/h2&gt;

&lt;p&gt;This is a known upstream bug, &lt;a href="https://github.com/cert-manager/cert-manager/issues/7540" rel="noopener noreferrer"&gt;cert-manager#7540&lt;/a&gt;. Cloudflare deprecated the &lt;code&gt;zone_id&lt;/code&gt; and &lt;code&gt;zone_name&lt;/code&gt; fields on DNS record responses. cert-manager took the zone ID for the cleanup request from the record it had looked up, so once the field was gone the URL became &lt;code&gt;/zones//dns_records/&amp;lt;id&amp;gt;&lt;/code&gt;. The error users posted in that issue reads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: 7003: Could not route to /client/v4/zones/dns_records/xxx, perhaps your object identifier is invalid?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The TXT record gets created, the challenge can even validate, and then the delete fails. Users in the issue reported it on v1.15.x, v1.16.3 and v1.17.0.&lt;/p&gt;

&lt;p&gt;The fix is &lt;a href="https://github.com/cert-manager/cert-manager/pull/7549" rel="noopener noreferrer"&gt;cert-manager#7549&lt;/a&gt;, "chore(issuer/cloudflare): ensure we set ZoneID". It sets the zone ID on the record from the zone lookup instead of relying on the API response. It shipped in v1.17.1 and v1.16.4, with the release note "Fix issuing of certificates via DNS01 challenges on Cloudflare after a breaking change to the Cloudflare API". The workaround people used in the meantime was deleting the leftover &lt;code&gt;_acme-challenge&lt;/code&gt; TXT records by hand. That has to be repeated on every renewal, so I upgraded instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Upgrade to v1.19.6 (#1020)
&lt;/h2&gt;

&lt;p&gt;My cluster runs Kubernetes 1.31. v1.19.6 was the newest cert-manager release that supports it: 1.20 needs 1.32 or newer, and 1.21 needs 1.33. The ArgoCD Application changed in three places:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;repoURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://charts.jetstack.io&lt;/span&gt;
    &lt;span class="na"&gt;targetRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1.19.6&lt;/span&gt;
    &lt;span class="na"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cert-manager&lt;/span&gt;
    &lt;span class="na"&gt;helm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
        &lt;span class="na"&gt;crds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="c1"&gt;# Keep CRDs (and with them every Certificate) if the release is removed.
&lt;/span&gt;          &lt;span class="na"&gt;keep&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="na"&gt;extraArgs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--dns01-recursive-nameservers=1.1.1.1:53,8.8.8.8:53&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--dns01-recursive-nameservers-only&lt;/span&gt;
  &lt;span class="c1"&gt;# ...
&lt;/span&gt;  &lt;span class="na"&gt;syncPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;automated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;prune&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;selfHeal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;syncOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ServerSideApply=true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;targetRevision: v1.19.6&lt;/code&gt;&lt;/strong&gt;, up from v1.14.4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;installCRDs: true&lt;/code&gt; becomes &lt;code&gt;crds.enabled&lt;/code&gt; plus &lt;code&gt;crds.keep&lt;/code&gt;.&lt;/strong&gt; &lt;code&gt;installCRDs&lt;/code&gt; is the old value name. &lt;code&gt;keep: true&lt;/code&gt; means removing the Helm release does not take the CRDs, and with them every &lt;code&gt;Certificate&lt;/code&gt;, along with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ServerSideApply=true&lt;/code&gt;.&lt;/strong&gt; The newer CRDs are larger. With client-side apply they would hit the size limit of the &lt;code&gt;last-applied-configuration&lt;/code&gt; annotation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Five minor versions in one step is a big jump for a component every HTTPS route depends on. Any version from v1.17.1 on has the fix. I took the newest one the cluster can run instead of the oldest one that works, so I would not be four releases behind again after the fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification
&lt;/h2&gt;

&lt;p&gt;After the upgrade the renewal completed. I checked the certificate, its expiry and the controller image directly instead of trusting the ArgoCD sync status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get certificate wildcard-woitzik-dev -n kube-system \
  -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{.status.conditions[?(@.type=="Ready")].status} {.status.notAfter} {.status.revision}{"\n"}'&lt;/span&gt;

kubectl get deploy -n cert-manager cert-manager \
  -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{.spec.template.spec.containers[0].image}{"\n"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The certificate is &lt;code&gt;Ready=True&lt;/code&gt; with &lt;code&gt;notAfter&lt;/code&gt; 2027-02-03T14:42:36Z, revision 3. The controller runs &lt;code&gt;quay.io/jetstack/cert-manager-controller:v1.19.6&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Only Noticed Six Days Before Expiry
&lt;/h2&gt;

&lt;p&gt;The renewal was stuck from 2026-10-12, and the first alert I saw was &lt;code&gt;CertManagerCertExpirySoon&lt;/code&gt; at seven days left. That gap is a monitoring problem on its own, and it got its own PR (#1021).&lt;/p&gt;

&lt;p&gt;The old certificate stays &lt;code&gt;Ready&lt;/code&gt; while a renewal fails, so a &lt;code&gt;Ready&lt;/code&gt; check says nothing until expiry. The new alert fires on the renewal time instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CertManagerRenewalOverdue&lt;/span&gt;
          &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;time() - certmanager_certificate_renewal_timestamp_seconds &amp;gt; 86400&lt;/span&gt;
          &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1h&lt;/span&gt;
          &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;critical&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A certificate that is more than 24 hours past its renewal time and still on the old certificate pages me.&lt;/p&gt;

&lt;p&gt;The second gap was my weekly report. It showed &lt;code&gt;Certs expiring &amp;lt;14d: none&lt;/code&gt; with nine days left. It only read &lt;code&gt;probe_ssl_earliest_cert_expiry&lt;/code&gt; from blackbox probes of public hosts, and those sit behind Cloudflare, so the probes saw Cloudflare's edge certificate, not my origin certificate. The report now also reads &lt;code&gt;certmanager_certificate_expiration_timestamp_seconds&lt;/code&gt;, which is cert-manager's own view of every certificate it manages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Check your cert-manager version if you use the Cloudflare DNS-01 solver.&lt;/strong&gt; Anything older than v1.16.4 or v1.17.1 builds the cleanup URL from a field Cloudflare no longer sends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A validated challenge is not a completed order.&lt;/strong&gt; Look at &lt;code&gt;kubectl get challenges,orders&lt;/code&gt; when a certificate does not renew. The cleanup error lives there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wildcard plus apex share one TXT name.&lt;/strong&gt; A failed cleanup on one challenge blocks the other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open egress for the propagation check&lt;/strong&gt; if you set &lt;code&gt;--dns01-recursive-nameservers&lt;/code&gt; and run a default-deny egress policy. Port 53 to those resolvers, both UDP and TCP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick the newest version your Kubernetes supports&lt;/strong&gt;, and check the chart values that changed on the way (&lt;code&gt;installCRDs&lt;/code&gt; to &lt;code&gt;crds.enabled&lt;/code&gt;, &lt;code&gt;crds.keep&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alert on renewal time, not only on expiry.&lt;/strong&gt; &lt;code&gt;certmanager_certificate_renewal_timestamp_seconds&lt;/code&gt; catches a stuck renewal weeks earlier than a seven-day expiry warning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Know which certificate your probes see.&lt;/strong&gt; Behind a proxy, a TLS probe reports the edge certificate, not yours.&lt;/li&gt;
&lt;/ul&gt;



</description>
      <category>kubernetes</category>
      <category>cloudflare</category>
      <category>security</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Trivy Action: Why severity CRITICAL,HIGH Still Uploaded 459 Findings</title>
      <dc:creator>david</dc:creator>
      <pubDate>Sun, 22 Nov 2026 16:30:44 +0000</pubDate>
      <link>https://dev.to/dwoitzik/trivy-action-why-severity-criticalhigh-still-uploaded-459-findings-1ck8</link>
      <guid>https://dev.to/dwoitzik/trivy-action-why-severity-criticalhigh-still-uploaded-459-findings-1ck8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/trivy-action-limit-severities-for-sarif-boolean/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I narrowed the Trivy SARIF upload in my homelab CI to &lt;code&gt;severity: CRITICAL,HIGH&lt;/code&gt;, reproduced it locally, got 0 results and declared the GitHub Security tab clean. It wasn't. The upload still carried all 459 MEDIUM and LOW findings, because &lt;code&gt;aquasecurity/trivy-action&lt;/code&gt; deletes the severity filter for SARIF output unless &lt;code&gt;limit-severities-for-sarif&lt;/code&gt; is exactly &lt;code&gt;true&lt;/code&gt;. My second attempt set that input to &lt;code&gt;CRITICAL,HIGH&lt;/code&gt;, which is not &lt;code&gt;true&lt;/code&gt;, so it changed nothing. A guard script I added the same afternoon caught it on its first run. Three PRs on 2026-10-02 (#821, #822, #823), and the interesting part is why the first check lied.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;security-scan&lt;/code&gt; job in &lt;code&gt;.github/workflows/ci.yml&lt;/code&gt; runs Trivy three times over the repo: two &lt;code&gt;format: table&lt;/code&gt; steps restricted to &lt;code&gt;severity: CRITICAL,HIGH&lt;/code&gt; that print findings in the log, and one &lt;code&gt;format: sarif&lt;/code&gt; step that uploads to the GitHub Security tab.&lt;/p&gt;

&lt;p&gt;The SARIF step had no severity filter. Measured against &lt;code&gt;kubernetes/&lt;/code&gt; with the repo's &lt;code&gt;.trivyignore&lt;/code&gt;, that produced 478 findings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error     19   HIGH/CRITICAL
warning  167   MEDIUM
note     292   LOW/UNKNOWN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the Security tab showed 478 alerts while the part CI cares about was 19. A 19-item signal under 459 advisory rows is a signal nobody reads, and because the count never moved, a real regression would have looked exactly like the backlog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attempt 1 (#821): Set Severity on the SARIF Step
&lt;/h2&gt;

&lt;p&gt;The plan in ADR-049 had two parts. Narrow the SARIF upload to the severities the table steps enforce, and move the 19 enforced findings into &lt;code&gt;.trivyignore&lt;/code&gt; with their evidence. Most of them were deliberate decisions already recorded in manifest comments, for example workloads that crash with &lt;code&gt;readOnlyRootFilesystem&lt;/code&gt; (I broke &lt;a href="https://dev.to/blog/kubernetes-securitycontext-hardening-broke-9-containers/"&gt;nine containers&lt;/a&gt; learning which ones). GitHub closes an alert when a later upload for the same analysis no longer contains it, so the tab should converge to zero without any dismissal API calls.&lt;/p&gt;

&lt;p&gt;The workflow change was one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;          &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sarif&lt;/span&gt;
          &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;trivy-results.sarif&lt;/span&gt;
          &lt;span class="na"&gt;trivyignores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.trivyignore&lt;/span&gt;
          &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CRITICAL,HIGH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check it, I reproduced the scan locally with the Trivy version CI runs, 0.70.0:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="nv"&gt;TRIVY_SEVERITY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;CRITICAL,HIGH trivy config kubernetes/ --format sarif --ignorefile .trivyignore
  -&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 0 results
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zero. I merged and called the tab clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attempt 2 (#822): Read the Log, Misread the Log
&lt;/h2&gt;

&lt;p&gt;Reading the CI job log afterwards, two things looked off. The action printed &lt;code&gt;Building SARIF report with all severities&lt;/code&gt;, and the Trivy invocation in the log was &lt;code&gt;trivy config kubernetes/&lt;/code&gt; with no &lt;code&gt;--severity&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;I explained both away. The action passes &lt;code&gt;severity&lt;/code&gt; to Trivy as the &lt;code&gt;TRIVY_SEVERITY&lt;/code&gt; environment variable, not as a flag, so a missing flag proved nothing. And I read "all severities" as the action announcing that its optional SARIF post-processing was skipped, not as a statement about the report. My local reproduction said 0, so I trusted that.&lt;/p&gt;

&lt;p&gt;To be safe I added the other input anyway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;          &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CRITICAL,HIGH&lt;/span&gt;
          &lt;span class="na"&gt;limit-severities-for-sarif&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CRITICAL,HIGH&lt;/span&gt;
          &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v0.70.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;version&lt;/code&gt; pins Trivy explicitly. CI had been running 0.70.0 only because that is the action's default, and I wanted a Trivy bump to be a deliberate change, not a side effect of updating the action.&lt;/p&gt;

&lt;p&gt;More importantly, the same PR added a guard. Trivy runs with &lt;code&gt;exit-code: 0&lt;/code&gt;, so nothing failed when a finding appeared on the Security tab. &lt;code&gt;scripts/check-trivy-sarif.py&lt;/code&gt; runs after the upload and fails the build if the SARIF contains any result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;document&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SARIF&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;runs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"runs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;runs&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"results"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"  0 findings at CRITICAL,HIGH -- code scanning stays clean."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"  {len(results)} finding(s) at CRITICAL,HIGH reached code scanning:\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also fails if the SARIF file is missing, so a skipped scan step can't pass as clean. In the workflow it runs under &lt;code&gt;if: always()&lt;/code&gt;, after the upload step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assert code scanning stays clean&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always()&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;python3 scripts/check-trivy-sarif.py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That way a regression updates the tab and turns CI red in the same run. I tested the script in three states: a real filtered SARIF passes, two injected findings fail and are listed, a missing file fails.&lt;/p&gt;

&lt;p&gt;The CI run for #822 failed in &lt;code&gt;Security / Trivy&lt;/code&gt;. The guard found 459 findings in the SARIF I had declared clean less than an hour earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Actual Mechanism
&lt;/h2&gt;

&lt;p&gt;The answer is in the action's &lt;code&gt;entrypoint.sh&lt;/code&gt; (v0.36.0, the version my workflow uses):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"${TRIVY_FORMAT:-}"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sarif"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"${INPUT_LIMIT_SEVERITIES_FOR_SARIF:-false,,}"&lt;/span&gt; != &lt;span class="s2"&gt;"true"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Building SARIF report with all severities"&lt;/span&gt;
    &lt;span class="kd"&gt;unset&lt;/span&gt; TRIVY_SEVERITY
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For SARIF output, the action deletes &lt;code&gt;TRIVY_SEVERITY&lt;/code&gt; before calling Trivy unless &lt;code&gt;limit-severities-for-sarif&lt;/code&gt; is the literal string &lt;code&gt;true&lt;/code&gt;. So &lt;code&gt;severity&lt;/code&gt; alone does not filter a SARIF report at all. The input that controls it is a boolean despite its plural name, and its description in &lt;code&gt;action.yaml&lt;/code&gt; is just "limit severities for SARIF format", with no default. Passing &lt;code&gt;CRITICAL,HIGH&lt;/code&gt; is not a narrower severity list. It is a value that is not &lt;code&gt;true&lt;/code&gt;, and it takes the branch that removes the filter.&lt;/p&gt;

&lt;p&gt;That also explains the log line I dismissed. &lt;code&gt;Building SARIF report with all severities&lt;/code&gt; is exactly what it says. It was the action telling me it had dropped the filter, and I read it as noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attempt 3 (#823): The One-Word Fix
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;          &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CRITICAL,HIGH&lt;/span&gt;
          &lt;span class="c1"&gt;# Boolean, not a list: unless exactly "true" the action unsets
&lt;/span&gt;          &lt;span class="c1"&gt;# TRIVY_SEVERITY (entrypoint.sh), so the SARIF carries every severity
&lt;/span&gt;          &lt;span class="c1"&gt;# no matter what the input above says.
&lt;/span&gt;          &lt;span class="na"&gt;limit-severities-for-sarif&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v0.70.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I reproduced both settings through the action's own logic: 459 results with &lt;code&gt;CRITICAL,HIGH&lt;/code&gt;, 0 with &lt;code&gt;true&lt;/code&gt;. The CI run for #823 passed, including &lt;code&gt;Security / Trivy&lt;/code&gt;, which means the guard saw an empty SARIF.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Local Check Lied
&lt;/h2&gt;

&lt;p&gt;This is the part I'd keep even if you never use Trivy. My reproduction in #821 was correct. &lt;code&gt;TRIVY_SEVERITY=CRITICAL,HIGH trivy config ...&lt;/code&gt; really returns 0 results with 0.70.0. It just measured a configuration the action never runs, because the action is written specifically to remove that variable. The local number was true and irrelevant.&lt;/p&gt;

&lt;p&gt;Nothing in the CI output contradicted me either. &lt;code&gt;Successfully uploaded results&lt;/code&gt; carries no count, so from the log alone a 0-result upload and a 459-result upload look the same. The only thing that settled it was a check running inside the real pipeline, on the real artifact, after the real action had done its work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Still Not Verified
&lt;/h2&gt;

&lt;p&gt;I could not look at the Security tab state through the API. Both tokens I had return &lt;code&gt;403&lt;/code&gt; for the code-scanning endpoints. The evidence that the tab converges is the guard passing on the uploaded file, plus GitHub's documented behavior of closing alerts that are absent from a later upload. That's good evidence, but it is not the same as reading the tab, and I'd rather say so than claim it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Check in Your Own Workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you use &lt;code&gt;format: sarif&lt;/code&gt; with trivy-action, set &lt;code&gt;limit-severities-for-sarif: true&lt;/code&gt;.&lt;/strong&gt; Without it, &lt;code&gt;severity&lt;/code&gt; does nothing for the SARIF output. Any other value, including a severity list, behaves like false.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grep your job log for &lt;code&gt;Building SARIF report with all severities&lt;/code&gt;.&lt;/strong&gt; If it's there, your SARIF is unfiltered no matter what &lt;code&gt;severity&lt;/code&gt; says.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reproduce through the tool you actually run.&lt;/strong&gt; Calling the scanner directly with your own env vars tests your assumptions about the wrapper, not the wrapper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the artifact, not the upload status.&lt;/strong&gt; A small script that counts &lt;code&gt;runs[].results[]&lt;/code&gt; in the SARIF and fails the build is about 45 lines. It caught this on its first run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin the scanner version separately from the action version&lt;/strong&gt;, so a new rule set arrives as its own reviewable change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same lesson keeps coming back in this homelab: the status I can see (a green upload, a Synced app) is not the state I care about. The &lt;a href="https://dev.to/blog/gitops-merged-not-applied-argocd-drift/"&gt;ArgoCD drift audit&lt;/a&gt; was that problem with deployments. This was that problem with the Security tab.&lt;/p&gt;



</description>
      <category>security</category>
      <category>cicd</category>
      <category>kubernetes</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Home Assistant on k3s: Smart Home Without the Cloud</title>
      <dc:creator>david</dc:creator>
      <pubDate>Sun, 22 Nov 2026 16:30:09 +0000</pubDate>
      <link>https://dev.to/dwoitzik/home-assistant-on-k3s-smart-home-without-the-cloud-o3h</link>
      <guid>https://dev.to/dwoitzik/home-assistant-on-k3s-smart-home-without-the-cloud-o3h</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/home-assistant-k3s-smart-home/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Home Assistant OS is the easiest way to run Home Assistant. It's also an appliance: it wants a whole machine or VM, backups live in its own backup system, and remote TLS means an add-on or a Nabu Casa subscription. I run Home Assistant Core as a plain Deployment on my k3s cluster instead, on the same &lt;a href="https://dev.to/go/4bv3yF1"&gt;BMAX Mini PC*&lt;/a&gt; as everything else. Traefik and cert-manager handle TLS, Authelia guards the UI, Velero backs it up, and ArgoCD deploys the manifest.&lt;/p&gt;

&lt;p&gt;Three things took real work: the SQLite recorder can't live on NFS, the container needs a writable &lt;code&gt;/run&lt;/code&gt; under a read-only root filesystem, and Home Assistant rejects proxied requests until you tell it about the proxy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Deployment
&lt;/h2&gt;

&lt;p&gt;One container, one PVC, in the &lt;code&gt;apps&lt;/code&gt; namespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant&lt;/span&gt;
  &lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Recreate&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant&lt;/span&gt;
          &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ghcr.io/home-assistant/home-assistant:2026.7.1&lt;/span&gt;
          &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;allowPrivilegeEscalation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
            &lt;span class="na"&gt;readOnlyRootFilesystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
            &lt;span class="na"&gt;seccompProfile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RuntimeDefault&lt;/span&gt;
            &lt;span class="na"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;drop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ALL"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
          &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8123&lt;/span&gt;
          &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TZ&lt;/span&gt;
              &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Europe/Berlin&lt;/span&gt;
          &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config&lt;/span&gt;
              &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/config&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tmp&lt;/span&gt;
              &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/tmp&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;run&lt;/span&gt;
              &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/run&lt;/span&gt;
          &lt;span class="na"&gt;readinessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/manifest.json&lt;/span&gt;
              &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8123&lt;/span&gt;
            &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
            &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
          &lt;span class="na"&gt;livenessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/manifest.json&lt;/span&gt;
              &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8123&lt;/span&gt;
            &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;
            &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
            &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
      &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config&lt;/span&gt;
          &lt;span class="na"&gt;persistentVolumeClaim&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;claimName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant-config&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tmp&lt;/span&gt;
          &lt;span class="na"&gt;emptyDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;run&lt;/span&gt;
          &lt;span class="na"&gt;emptyDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few choices in there are not defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pinned tag, not &lt;code&gt;stable&lt;/code&gt;.&lt;/strong&gt; Renovate opens a PR per release, so an update is a Git commit with CI and a soak period instead of a surprise on the next pod restart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;strategy: Recreate&lt;/code&gt;.&lt;/strong&gt; The PVC is &lt;code&gt;ReadWriteOnce&lt;/code&gt; and the recorder database must never have two writers. A rolling update would start the new pod while the old one still holds the volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-only root filesystem with an &lt;code&gt;emptyDir&lt;/code&gt; on &lt;code&gt;/run&lt;/code&gt;.&lt;/strong&gt; The image uses s6-overlay v3, and its init runs &lt;code&gt;rm -rf /run/s6&lt;/code&gt; on startup. Without a writable &lt;code&gt;/run&lt;/code&gt; the container dies with &lt;code&gt;Read-only file system&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Probes on &lt;code&gt;/manifest.json&lt;/code&gt;.&lt;/strong&gt; It returns 200 without an auth token once the frontend is up, unlike &lt;code&gt;/api/*&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A 300-second liveness delay.&lt;/strong&gt; After a restore or an unclean shutdown, the recorder can spend minutes recovering its SQLite database. A short liveness probe kills the pod in the middle of that and starts the recovery over.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Storage: local-path, Not NFS
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PersistentVolumeClaim&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;home-assistant-config&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;ReadWriteOnce&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;storageClassName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-path&lt;/span&gt;
  &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;5Gi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/config&lt;/code&gt; holds the configuration, automations, and &lt;code&gt;home-assistant_v2.db&lt;/code&gt;, the recorder's SQLite database in WAL mode. Home Assistant started on &lt;code&gt;nfs-client&lt;/code&gt; like most of my apps. It was the last of six SQLite apps I moved to &lt;code&gt;local-path&lt;/code&gt; after an audit found them all on NFS, for the reasons in &lt;a href="https://dev.to/blog/nfs-vs-local-path-sqlite-trap/"&gt;the NFS vs local-path SQLite trap&lt;/a&gt;. Before the move I ran &lt;code&gt;PRAGMA integrity_check&lt;/code&gt;, copied the data over, and checked again on the live container afterward. The recorder logged its usual unclean-shutdown warning on first start and recovered on its own.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;local-path&lt;/code&gt; ties the pod to one node. For a single-writer workload that writes state constantly, I'll take node-local latency over the ability to reschedule.&lt;/p&gt;

&lt;p&gt;If you'd rather move the recorder off SQLite entirely, the setting lives under &lt;code&gt;recorder:&lt;/code&gt; in &lt;code&gt;configuration.yaml&lt;/code&gt;, not under &lt;code&gt;homeassistant:&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;recorder&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;db_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgresql://homeassistant:PASSWORD@home-assistant-db.apps.svc:5432/homeassistant&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;a href="https://dev.to/blog/cnpg-postgresql-operator-k3s/"&gt;CNPG cluster&lt;/a&gt; works as the backend. I haven't needed it: SQLite on local storage is fine for one house.&lt;/p&gt;

&lt;h2&gt;
  
  
  Behind Traefik and Authelia
&lt;/h2&gt;

&lt;p&gt;The UI is published through a Traefik IngressRoute with the CrowdSec bouncer and Authelia in front:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;traefik.io/v1alpha1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IngressRoute&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ha-final&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;entryPoints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;websecure&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Host(`ha.woitzik.dev`)&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Rule&lt;/span&gt;
      &lt;span class="na"&gt;middlewares&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;name:&lt;/span&gt; &lt;span class="s"&gt;crowdsec-bouncer&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;name:&lt;/span&gt; &lt;span class="s"&gt;authelia&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;name:&lt;/span&gt; &lt;span class="s"&gt;home-assistant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;port:&lt;/span&gt; &lt;span class="mi"&gt;8123&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Companion app can't complete an Authelia redirect, so it is meant to connect over the Headscale VPN instead, the same pattern as Jellyfin's native clients.&lt;/p&gt;

&lt;p&gt;The first version of this returned &lt;code&gt;400 Bad Request&lt;/code&gt; for every request. Home Assistant's own log said why: "A request from a reverse proxy was received ... but your HTTP integration is not set-up for reverse proxies". The fix is an &lt;code&gt;http:&lt;/code&gt; block in &lt;code&gt;configuration.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;use_x_forwarded_for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;trusted_proxies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;10.42.0.0/16&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;10.42.0.0/16&lt;/code&gt; is the whole k3s pod CIDR, because Traefik's pod IP changes on every restart. &lt;code&gt;configuration.yaml&lt;/code&gt; lives on the PVC and is edited through Home Assistant's own file editor, not in Git, so I documented the fix as a comment in the Kubernetes manifest. Otherwise the next person to read the repo has no idea why it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backups and Restore
&lt;/h2&gt;

&lt;p&gt;The PVC is covered by the cluster-wide Velero schedules, with file-system backup through the node-agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;daily-backup&lt;/code&gt; at 05:00 UTC to Garage, kept 7 days&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;daily-offsite&lt;/code&gt; at 04:00 UTC to Cloudflare R2, which includes the &lt;code&gt;apps&lt;/code&gt; namespace, kept 3 days&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before a risky change I take an on-demand copy from the schedule template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;velero backup create ha-before-change --from-schedule daily-backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;velero backup create&lt;/code&gt; has no &lt;code&gt;--schedule&lt;/code&gt; flag. Recurring backups are &lt;code&gt;velero schedule create&lt;/code&gt; or a &lt;code&gt;Schedule&lt;/code&gt; manifest, and &lt;code&gt;--from-schedule&lt;/code&gt; reuses that template for a one-off run.&lt;/p&gt;

&lt;p&gt;The restore I've actually tested is file-level: scale the Deployment to 0, mount the PVC in a throwaway pod, copy the saved &lt;code&gt;/config&lt;/code&gt; directory in, scale back to 1. After the August 2026 rebuild I verified it by comparing file counts and contents against the pre-disaster copy, not by checking that the pod showed &lt;code&gt;Running&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Setup Doesn't Do
&lt;/h2&gt;

&lt;p&gt;No Zigbee or Bluetooth. Home Assistant OS manages radios for you; on k3s a USB coordinator means pinning the pod to the node that has the stick and passing the device through, and my three k3s VMs have no radio attached today. You also lose the add-on store, since add-ons are a Supervisor feature that Home Assistant Core doesn't have.&lt;/p&gt;

&lt;p&gt;What you gain is a Home Assistant that is versioned, reviewed, backed up, and TLS-terminated the same way as the other workloads on the cluster. If you already run k3s, that's the better trade.&lt;/p&gt;



</description>
      <category>kubernetes</category>
      <category>homeassistant</category>
      <category>iot</category>
      <category>homelab</category>
    </item>
    <item>
      <title>Tailscale on k3s: Exit Nodes, Subnet Routes, and ACLs</title>
      <dc:creator>david</dc:creator>
      <pubDate>Thu, 19 Nov 2026 19:38:22 +0000</pubDate>
      <link>https://dev.to/dwoitzik/tailscale-on-k3s-exit-nodes-subnet-routes-and-acls-gco</link>
      <guid>https://dev.to/dwoitzik/tailscale-on-k3s-exit-nodes-subnet-routes-and-acls-gco</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://woitzik.dev/blog/tailscale-k3s-exit-node-subnet/" rel="noopener noreferrer"&gt;woitzik.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/blog/mikrotik-wireguard-vpn-terraform/"&gt;WireGuard on MikroTik&lt;/a&gt; worked, but every device needed a hand-written peer config with the right allowed IPs and DNS. Tailscale builds on WireGuard and adds NAT traversal, key distribution, and ACLs. My tailnet runs against a &lt;a href="https://dev.to/blog/headscale-oidc-k3s-authelia/"&gt;self-hosted Headscale control server&lt;/a&gt;, and one ordinary Tailscale client running as a pod in k3s gives my phone and laptop two things: a route into the server VLAN and an exit node for mobile-data traffic. The &lt;a href="https://dev.to/go/4w08b21"&gt;RB5009*&lt;/a&gt; doesn't run Tailscale at all; it stays the firewall that enforces VLAN segmentation behind that route.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/dwoitzik/homelab-infrastructure" rel="noopener noreferrer"&gt;View the complete homelab infrastructure source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Subnet Routes vs Exit Nodes
&lt;/h2&gt;

&lt;p&gt;Both are features of a normal Tailscale node, and they solve different problems:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subnet routes&lt;/strong&gt; let tailnet devices reach a LAN range through one node, without installing Tailscale on anything in that range. The servers on &lt;code&gt;10.0.20.0/24&lt;/code&gt; never see a Tailscale client; they see traffic arriving from the subnet router. Internet traffic on the remote device keeps using its normal connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit nodes&lt;/strong&gt; route &lt;em&gt;all&lt;/em&gt; of a device's internet traffic through the chosen node, so the device's public IP becomes the homelab's. The remote device still needs a Tailscale client and has to select the exit node; nothing on the home LAN changes.&lt;/p&gt;

&lt;p&gt;For most homelabs, a subnet route is enough. I also run the exit node because I want mobile-data traffic to leave through my own WAN uplink.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Router Pod
&lt;/h2&gt;

&lt;p&gt;The node is a single-replica Deployment of the official &lt;code&gt;tailscale/tailscale&lt;/code&gt; image, configured entirely through &lt;code&gt;containerboot&lt;/code&gt; environment variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TS_ROUTES&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"10.0.20.0/24"&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TS_HOSTNAME&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"homelab-router"&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TS_EXTRA_ARGS&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"--login-server=https://headscale.woitzik.dev --advertise-tags=tag:subnet-router --advertise-exit-node"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The route used to be &lt;code&gt;10.0.0.0/16&lt;/code&gt;, which advertised every VLAN (management, DMZ, IoT, admin) to any approved tailnet device and bypassed the MikroTik's zero-trust segmentation for VPN clients. The real use case is internal services behind the Traefik VIP on the server VLAN, so the route is now scoped to that one &lt;code&gt;/24&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two details cost me time. The pod has to run &lt;code&gt;privileged&lt;/code&gt;, not just with &lt;code&gt;NET_ADMIN&lt;/code&gt;/&lt;code&gt;NET_RAW&lt;/code&gt;: containerd mounts &lt;code&gt;/proc/sys/net/ipv4/conf/*/src_valid_mark&lt;/code&gt; read-only for unprivileged pods, &lt;code&gt;tailscaled&lt;/code&gt; can't set it, and forwarded traffic fails the reverse-path filter and is silently dropped. The visible symptom is a "subnet routing enabled but IP forwarding is disabled" health warning. And the node state lives on a small PVC, so a pod restart doesn't register a new node.&lt;/p&gt;

&lt;h2&gt;
  
  
  ACLs and Auto-Approval
&lt;/h2&gt;

&lt;p&gt;Headscale reads the same HuJSON policy format as Tailscale. Mine is a single-operator tailnet, so the ACL itself is short. The interesting part is who may become a router:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"groups"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"group:admin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"dw@"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"david@"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"tagOwners"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"tag:subnet-router"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"group:admin"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"acls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"accept"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"group:admin"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"dst"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"*:*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"autoApprovers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"routes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"10.0.20.0/24"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tag:subnet-router"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"exitNode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tag:subnet-router"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only &lt;code&gt;group:admin&lt;/code&gt; can tag a node &lt;code&gt;tag:subnet-router&lt;/code&gt;, and only a node with that tag gets its routes auto-approved. Any other node can still advertise routes, but they sit unapproved until someone approves them by hand with &lt;code&gt;headscale nodes approve-routes&lt;/code&gt;, so a rogue or misconfigured node can't route itself into the LAN or become an exit node. The two users in the group are the same person: logging in through OIDC created a second Headscale user (&lt;code&gt;david&lt;/code&gt;) next to the manually created &lt;code&gt;dw&lt;/code&gt;, and default-deny silently blocked that device until it was added.&lt;/p&gt;

&lt;p&gt;If you add more users later, this is where least privilege starts: replace &lt;code&gt;*:*&lt;/code&gt; with explicit destinations such as &lt;code&gt;10.0.20.0/24:443&lt;/code&gt; and &lt;code&gt;autogroup:internet:*&lt;/code&gt; for exit-node use.&lt;/p&gt;

&lt;h2&gt;
  
  
  NAT Traversal
&lt;/h2&gt;

&lt;p&gt;The cluster sits behind two layers of NAT: the RB5009, and upstream of it a &lt;a href="https://dev.to/go/4f5WDEI"&gt;FritzBox*&lt;/a&gt; (a 6591 Cable) on the WAN side. Tailscale handles this without port forwarding. Clients use STUN to discover their public endpoints and try a direct WireGuard path; when no direct path is possible, traffic falls back to a DERP relay. I don't run my own DERP server; Headscale hands clients Tailscale's public DERP map. Relayed traffic still works, just with higher latency, and &lt;code&gt;tailscale status&lt;/code&gt; shows which path a peer is using.&lt;/p&gt;

&lt;h2&gt;
  
  
  The IPv6 Exit-Node Trap
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;--advertise-exit-node&lt;/code&gt; always advertises both &lt;code&gt;0.0.0.0/0&lt;/code&gt; and &lt;code&gt;::/0&lt;/code&gt;. There is no IPv4-only exit node: advertising &lt;code&gt;0.0.0.0/0&lt;/code&gt; on its own is rejected with "0.0.0.0/0 advertised without its IPv6 counterpart, please also advertise ::/0". My k3s pod network is IPv4-only. The pod has IPv6 forwarding enabled but no global IPv6 address and no IPv6 uplink, so it advertises IPv6 exit capability it cannot deliver.&lt;/p&gt;

&lt;p&gt;The symptom on my phone was slow push notifications and app data while using the exit node. Narrowing the route approval in Headscale didn't help, and didn't even hold, because &lt;code&gt;autoApprovers.exitNode&lt;/code&gt; re-approved whatever the tagged node advertised on the next policy reconcile. The approval command reported success, and &lt;code&gt;headscale nodes list-routes&lt;/code&gt; showed &lt;code&gt;::/0&lt;/code&gt; approved again seconds later. The real fix is dual-stack egress for the router pod, which I haven't built yet. If your cluster network is IPv4-only, expect the same behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Routers, Manual Exit Choice
&lt;/h2&gt;

&lt;p&gt;The router pod isn't the only node. &lt;code&gt;rpi-srv-02&lt;/code&gt;, one of the two Raspberry Pi 4B DNS boxes, runs Tailscale natively and advertises the same three prefixes: &lt;code&gt;10.0.20.0/24&lt;/code&gt;, &lt;code&gt;0.0.0.0/0&lt;/code&gt;, and &lt;code&gt;::/0&lt;/code&gt;. Both nodes are approved for all three in Headscale.&lt;/p&gt;

&lt;p&gt;For the LAN route, that overlap is Headscale's high-availability mode: when two nodes advertise the same prefix, one is primary, and if it goes offline the other serves the route. Exit nodes work differently from the client's side. The phone uses the exit node I selected in the app. If that node goes down, its internet traffic stops until I pick the other one or turn the exit node off.&lt;/p&gt;

&lt;p&gt;The Pi is the weaker of the two, so I tried revoking its exit-node approval and keeping it as a LAN-route-only fallback. Because of the IPv6 trap above, that left the router pod as the only exit candidate for a &lt;code&gt;::/0&lt;/code&gt; it can't serve, and IPv6-first traffic on the phone hung outright instead of just being slow. I rolled it back the same day. Dropping &lt;code&gt;--advertise-exit-node&lt;/code&gt; from the router pod instead doesn't help either: the Pi advertises the same bundled &lt;code&gt;0.0.0.0/0&lt;/code&gt; plus &lt;code&gt;::/0&lt;/code&gt; pair on its own, so that wouldn't close the IPv6 gap, and all exit traffic would land on the weaker board. If I were replacing that Pi today, it would be a &lt;a href="https://dev.to/go/4wETNfv"&gt;Raspberry Pi 5*&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tailscale status --json&lt;/code&gt; inside the router pod shows every peer, whether it's online, and its traffic counters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tailscale status --json &lt;span class="o"&gt;|&lt;/span&gt; jq &lt;span class="s1"&gt;'.Peer[] | {Name: .HostName, Online: .Online, RX: .RxBytes, TX: .TxBytes}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the control-plane side, &lt;code&gt;headscale nodes list-routes&lt;/code&gt; is the ground truth for which routes are advertised, approved, and actually serving. After any routing change, check it instead of trusting the command's exit status.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trade-off
&lt;/h2&gt;

&lt;p&gt;With Tailscale's hosted control plane, your device list, IPs, and connection metadata live on their servers. Running Headscale moves that state onto your own hardware, at the cost of operating one more service; the data plane is WireGuard either way. If you don't want a coordination server at all, plain WireGuard on MikroTik, managed with Terraform, is still the alternative.&lt;/p&gt;



</description>
      <category>networking</category>
      <category>vpn</category>
      <category>tailscale</category>
      <category>homelab</category>
    </item>
  </channel>
</rss>
