~/incidents · postmortems

/incident log

outages, mistakes and migrations · documented, not forgotten
journalctl --since forever honest, no varnish

Things break. That's fine — what matters is writing down what happened, what fixed it, and what I learned. This is my honest log of operating a four-node k3s cluster on Raspberry Pis: outages, mistakes and migrations. Each entry follows the same structure: what happened → diagnosis → fix → lessons.

grep -n "^##" incidents.md 5 entries · newest learnings at the bottom

001 — A Kubernetes JWT in a public repo

Security Kubernetes Time: Status: resolved details

What happened

GitGuardian flagged one of my public repositories and told me it had found a leaked credential — a Kubernetes service account token, a JWT, committed alongside a manifest or script. Nothing dramatic to look at: just a long string in a file I had pushed to publish my homelab work. But that string is exactly the kind of thing automated scanners crawl GitHub for, and in the worst case it represents a valid identity inside my cluster.

Diagnosis

First step: figure out whether the token was actually valid, not just expired. I decoded the JWT, checked the issuer and the bound service account, and reviewed what RBAC rights that account had in the cluster. The uncomfortable part wasn't that the token existed — it was realizing how easy it is to accidentally ship it when manifests, kubeconfigs and shell scripts live side by side in the same repo.

Fix

  • Revoked and rotated the affected credentials and service account tokens.
  • Removed the secret from the repository history with git-filter-repo — deleting the file alone leaves the token recoverable in old commits.
  • Added .gitignore rules for kubeconfigs, tokens, CA certificates and other credential-bearing files.
  • Enabled secret scanning on my repos so the next slip gets caught at commit time instead of by an external bot.
  • Moved collection jobs to a dedicated ServiceAccount with narrow RBAC in a monitoring namespace — future tokens, even if leaked, have minimal blast radius.

What I learned

The lesson wasn't "never publish your cluster configs" — sharing the homelab is the point of the portfolio. The lesson is that publishing requires a deliberate boundary: history rewriting as a routine skill, ignore rules as muscle memory, and least-privilege service accounts so that a mistake is cheap instead of catastrophic. The scan alert cost me an evening; a live token in the wild would have cost much more.

002 — etcd on borrowed time: SD card to USB-SSD

Storage etcd Time: Status: resolved details

What happened

The control-plane node (winterfell) kept its cluster state — etcd — on the boot SD card, because that's how the node was originally set up. SD cards are built for read-heavy workloads; etcd is the opposite: continuous small writes, wal files, compaction traffic around the clock. It became clear this was not a theoretical risk but an eventual certainty.

Diagnosis

The core realization: consumer flash degrades under sustained write load, and a corrupted SD card doesn't corrupt gracefully — it takes the whole cluster state with it. Quorum lives on this one disk.

Fix

  • Stopped k3s on winterfell, rsynced the entire data directory (/var/lib/rancher/k3s) from the SD card to the USB-SSD.
  • Mounted the XFS-formatted SSD via /etc/fstab at the original data-directory path — k3s needed zero configuration change.
  • Verified etcd quorum and all nodes rejoining before wiping the old SD card copy.

What I learned

Storage decisions for cluster state are not infrastructure trivia — they are a bet on how the storage medium fails. Etcd is the last place you want a medium that wears out silently. Separating OS and data also paid off later: reimaging a node means pulling the SD card without touching the cluster data.

003 — Node rejoins fail: tokens, drift, reimaging

k3s Operations Time: Status: mitigated — occasionally recurring details

What happened

After updates — or a node that had been offline longer than expected — workers stopped rejoining the cluster. Same hardware, same network, same hostname: the node simply refused to register. The cluster ran, the node was reachable, but kubectl get nodes showed it as NotReady or missing entirely.

Diagnosis

The usual suspects, in the order I stopped trusting them: k3s join token mismatches (tokens rotate server-side, stale copies linger on nodes), configuration drift between what the node booted with and what upgrades had left behind, and version skew between the control-plane and the rejoining worker. Debugging felt circular: the service runs, the network answers, the registration still fails.

Fix

  • Short path: re-register the node with a fresh join token — works when the token is the only problem.
  • Medium path: align the k3s version with the control-plane before rejoining, since version skew compounds token issues.
  • Last resort, taken more than once: full reimage of the node. When configuration drift outweighs the value of the node's local state, rebuilding is cheaper than archaeology.

What I learned

Reimaging feels like defeat and is actually strategy. The discipline that makes it cheap is treating node setup as a repeatable process — keeping join tokens fresh, versions pinned, and knowing exactly which state lives on the node vs. in the cluster. A cluster where rebuilding any member is boring is a healthy cluster.

004 — Helm type trap: float64 vs. int

Helm Monitoring Time: Status: resolved details

What happened

While building custom dashboards for Velero backup age, the Helm templating kept failing with obscure errors about comparing timestamps. Numbers arrived from the Kubernetes API, but apparently not in the type the template expected.

Diagnosis

Go's JSON decoder unmarshals numbers into float64 — so a Unix timestamp that arrives as a number is suddenly not an integer, and strict type comparisons in Helm templates refuse to compare float64 against an int literal. The error message pointed at the comparison, not at the type mismatch, which is why the first fixes didn't work.

Fix

  • Explicit type conversion at the comparison site instead of hoping the values align.
  • Compared seconds-as-integers rather than mixing raw API values and literals.

What I learned

Type systems follow you everywhere — even into templates you thought were "just text". When a template error is cryptic, distrust the values, not the syntax: half of my Helm debugging sessions ended with a type I didn't expect coming out of the API.

005 — Split-brain repository: two writers, one repo

Git Automation Time: Status: resolved details

What happened

Two writers, one repository: the collector on the control-plane node pushes cluster.json every 5 minutes via the GitHub API, while my desktop checkout continued to believe it was the only one. Non-fast-forward rejections, failed rebases on dirty trees, a detached HEAD somewhere along the way — and more than once, me debugging "the network" when the actual problem was standing on which host I was pushing from.

Diagnosis

A repo stops being a simple thing once an automated process writes to it through the API. The desktop checkout ages by the minute; every manual push from it is a surprise to git. On top of that, a stash-pop during cleanup left duplicate function declarations in dashboard.js and conflict markers in style.css — and since the last declaration silently wins in JavaScript, the broken version ran without a single error. It shipped to production and I only caught it via screenshot.

Fix

  • Treat the Pages repo as a deploy target, not a working tree: collect data via API pull, never edit on the desktop without pulling first.
  • After any conflict resolution, verify the resulting files themselves — not just that the diff looks plausible. Silent duplicates are the dangerous case.
  • Know which host you are on before you push — and check git status before blaming the network.

What I learned

Automation changed the personality of the repository. What used to be "my files" is now a pipeline with a human attached, and the human part has to adapt: pull before push, trust files over diffs, and accept that the scariest bugs are the ones that don't throw errors.