Cluster-wide outage from Tailscale node flapping
Date: 2026-09-04 Duration: ~3 hours (acute outage) + follow-on cleanup Severity: High — cluster-wide impact (production, staging, registry, messaging) Status: Resolved and verified
Summary¶
castis-desktop (a control-plane/etcd node) began flapping between Ready
and NotReady, with nuc-a also affected. This triggered a cascade through
Longhorn storage into apisix's own etcd (its routing config store), which
took down apisix entirely — including the registry.nexus.castis.io route —
causing cluster-wide ImagePullBackOff on every node, not just the flapping
ones. A secondary, related issue (Traefik reappearing on rejoined nodes) was
found and fixed during follow-up cleanup.
Root Causes¶
Two independent, compounding causes were identified on the affected nodes
(castis-desktop, nuc-a):
-
Tailscale route conflict. Tailscale was installed on every node in the cluster with
--accept-routesenabled on all of them (via Headscale, this cluster's self-hosted Tailscale control server). At least one node had also advertised the cluster's own LAN subnet (<OFFICE_LAN_CIDR>) as a Tailscale subnet route, and Headscale had approved it. Because every node was set to accept advertised routes, that LAN route got pulled into the routing table of nodes that were already directly on that same LAN themselves — nodes don't need Tailscale to reach each other over their own local network. In short: the network no longer knew which path to take — traffic between nodes could get pulled into the Tailscale/WireGuard tunnel instead of the direct LAN, inconsistently and unpredictably. This produced intermittent, asymmetric connectivity (packet loss, timeouts, and TLS handshake noise during etcd peer reconnects — WireGuard's smaller MTU can fragment/corrupt a TLS handshake in transit) rather than a clean up/down failure, and made core cluster networking depend ontailscaledstaying healthy for traffic that should never have left the LAN. Removing Tailscale fromnuc-aresolved that node's instability, confirming it as a real contributing cause. Thetailscaledservice has since been stopped on the affected nodes (not uninstalled) — see Follow-ups for the safe re-test performed onmac-miniwith--accept-routesoff. -
k3s version skew across control-plane nodes.
castis-desktopandnuc-awere runningv1.33.3+k3s1whilenuc-bhad already been manually upgraded tov1.34.5+k3s1(no automated upgrade controller was in use). Running mismatched etcd/raft protocol versions across HA control-plane members for an extended period is unsupported and produced intermittent consensus failures, elevated etcd latency, and "bad certificate"-style TLS handshake noise during peer reconnects.
These two factors compounded each other — network disruption from Tailscale made the already-fragile mixed-version etcd raft communication even less reliable, producing the flapping.
Cascade¶
castis-desktop / nuc-a flapping NotReady
│
▼
Longhorn loses replicas hosted on the flapping nodes
│ (instance-manager pods restart repeatedly,
│ replicas marked failed, auto-salvage storms)
▼
~30 Longhorn volumes go degraded/faulted/unknown cluster-wide
│
▼
apisix's own etcd (separate 3-pod StatefulSet, just its
routing-config store — NOT k3s's cluster etcd) loses quorum
because its volumes can't attach reliably
│
▼
apisix itself goes down ("no healthy etcd endpoint available")
│
▼
registry.nexus.castis.io route breaks (504 → connection refused)
│
▼
Cluster-wide ImagePullBackOff on every node (not just the
flapping ones) — production, staging, and messaging workloads
all affected
Key Diagnostic Findings Along the Way¶
- k3s's own cluster etcd (embedded in the
k3sprocess, 3 members) never actually lost quorum — 2 of 3 members (nuc-a,nuc-b) stayed available throughout. The instability was real but not a full k3s control-plane outage. - apisix's
etcdStatefulSet is a separate etcd cluster from k3s's own, used only as apisix's config cache. Its data is fully disposable — the actual source of truth is theApisixRoute/ApisixUpstreamCRDs, whichapisix-ingress-controllercontinuously re-syncs into it. - Ruled out during investigation: OOM kills (none found in
dmesg), etcd CA/cert mismatch (fingerprints matched exactly across nodes), clock drift (NTP synced on all nodes checked). castis-desktop's etcd membership became corrupted after repeated forced interruptions during the incident, requiring a full member remove-and-rejoin rather than a simple restart.- apisix's
etcd-0/1/2pods went through a secondary "synchronization race" after their PVCs were reset: each pod requires seeing the other two resolvable via the headless service DNS simultaneously to complete initial bootstrap. With each pod crash-looping on an independent ~60s timer, they kept narrowly missing each other. Fixed by force-deleting all three pods close together so their restarts overlapped.
Resolution Steps Taken¶
- Removed Tailscale from
nuc-a(later removed cluster-wide). - Upgraded
nuc-aandcastis-desktoptov1.34.5+k3s1to matchnuc-b: castis-desktop's etcd membership was corrupted beyond a simple restart fixing it, so it was removed and rejoined as a fresh member:- Reset apisix's etcd (safe — disposable config cache, re-synced automatically from k8s CRDs):
- Force-cleared several pods stuck
Terminating/Initdue to lingering Longhorn volume-attach state, and later force-deletedetcd-0/etcd-1together to resolve the bootstrap synchronization race described above: - Once the etcd cluster achieved a stable 3-way quorum, Longhorn volumes self-healed and apisix/registry came back automatically.
- Force-deleted remaining
ImagePullBackOffpods to trigger an immediate retry (rather than waiting on k8s's exponential backoff) once the registry was confirmed reachable again. - Follow-up fix — Traefik reappeared on rejoined nodes.
nuc-balready had/etc/rancher/k3s/config.yamlwithdisable: traefikset (this cluster uses apisix as its ingress, not the k3s-bundled Traefik), butcastis-desktopandnuc-alost this node-local file when they were freshly reinstalled/rejoined during the incident (step 2–3 above). Their k3s addon manager then re-created thetraefik/traefik-crdHelmChartresources, which got stuck inCrashLoopBackOff(thetraefikchart install failed because its required CRDs, installed by the separatetraefik-crdchart, were missing). Fixed by restoring the sameconfig.yamlto both nodes, restartingk3s, and deleting the staleHelmChart/Jobresources:
Verified Final State¶
Confirmed via kubectl after all fixes:
- Nodes: all 4 (
castis-desktop,nuc-a,nuc-b,mac-mini)Ready, control-plane nodes aligned onv1.34.5+k3s1. - Pods: zero pods cluster-wide in any state other than
Running/Succeeded. - Longhorn: every currently-
attachedvolume ishealthy. Remainingunknown/detachedvolumes are not attached to anything and not blocking any workload. - apisix: all
etcd-0/1/2pods1/1 Running; all gateway, dashboard, and ingress-controller podsRunning. - Registry:
registry.nexus.castis.ioreturns401on manifest requests — the correct behavior for an unauthenticated Docker registry v2 API call, confirming the full path (DNS → apisix → etcd config → route → nexus) works end-to-end. - Traefik: no leftover
HelmChart/Job/pod resources on any node.
Follow-ups / Recommendations¶
- Stop
tailscaledon the affected nodes and validate a safe re-introduction path — done, see full "Tailscale Safe Re-Setup" section below for the complete procedure, findings, and current rollout status. - Restore
disable: traefikon rejoined nodes and clean up stale Traefik resources — done. - Establish a process for keeping k3s versions in sync across all
control-plane nodes — this version skew was the root structural cause.
Consider the Rancher
system-upgrade-controllerfor automated, coordinated upgrades instead of manual per-node upgrades. - Track node-local k3s config (
/etc/rancher/k3s/config.yaml) in this repo (e.g. as a reference file per node, or provisioned via cloud-init/Ansible) rather than only on-disk. The Traefik regression above happened specifically because this file existed only locally onnuc-band had no record anywhere else — a node reinstall silently lost it. The same risk applies to anything else configured ad hoc on individual nodes and not captured in this IaC repo. - Clean up the orphaned faulted Longhorn volume left over from the apisix-etcd reset (safe, no longer referenced by any PVC):
- Consider monitoring/alerting on k3s node version drift and on Longhorn volume robustness, so this class of incident is caught before it cascades into a full outage next time.
- Confirm whether
nuc-b(the original route-advertising node — see Tailscale Safe Re-Setup section) still has an active route advertisement, and decide whether to remove it entirely. - Rotate/expire the Tailscale preauth key committed in plaintext in
headscale/TailscaleClientInstall.md's git history.
Tailscale Safe Re-Setup (Follow-up, 2026-09-07)¶
Three days after the incident, Tailscale was reintroduced on a per-node basis for remote-access purposes, using the safe configuration validated below: joined to the same Headscale tailnet, but without accepting or advertising any routes, so it can never again interfere with cluster-internal networking.
Prerequisites¶
- Headscale (self-hosted Tailscale control server) runs on a separate
cluster from this k3s cluster — not in
playtelly-iac. Generate preauth keys there, not here. - A preauth key, generated per-node (reusable keys are fine for a short rollout window, but prefer short expirations):
Per-node procedure¶
1. Check inotify limits first (k3s nodes only). A busy k3s node can
exhaust the default Linux fs.inotify.max_user_instances (128), which
causes unrelated failures like systemd/tailscaled failing with
"Failed to allocate directory watch: Too many open files" — this hit
nuc-a mid-rollout, unrelated to Tailscale itself. Fix once, on every node:
echo 'fs.inotify.max_user_instances = 1024' | sudo tee -a /etc/sysctl.d/99-k3s-inotify.conf
echo 'fs.inotify.max_user_watches = 524288' | sudo tee -a /etc/sysctl.d/99-k3s-inotify.conf
sudo sysctl --system
2. Install (or reuse existing install):
3. If Tailscale was previously configured on this node, wipe its state
first. Old --advertise-routes/--accept-routes config persists in
tailscaled's state file, not just in the last tailscale up command's
flags — just stopping the service is not enough, since the old config
comes right back the next time it's started unless the state is cleared:
sudo systemctl stop tailscaled
sudo rm -f /var/lib/tailscale/tailscaled.state
sudo systemctl start tailscaled
sudo systemctl enable tailscaled
4. Join — no route acceptance, no advertisement:
Deliberately do not pass--accept-routes or --advertise-routes —
both default to off, and that's exactly what we want. If DNS health
warnings show up (MagicDNS trying to override this cluster's custom
resolv-conf kubelet arg), disable it explicitly:
5. Verify it didn't touch cluster networking:
Expect to see, intailscale status, a health-check note like "Some peers
are advertising routes but --accept-routes is false" — that confirms
routes ARE still being advertised somewhere in the tailnet, and this node
is correctly ignoring them. In ip route show, the LAN route
(<OFFICE_LAN_CIDR> dev <lan-iface>) and flannel/cni routes must be completely
unaffected — no tailscale0 involvement. If it's a k3s node, also confirm
from another node that it didn't drop out of the cluster during setup:
Understanding tailscale status output¶
Columns reflect live traffic, not just reachability:
| Status shown | Meaning |
|---|---|
- (blank) |
Peer is connected to Headscale, but no recent traffic exchanged with it from this node — idle, not broken. |
offline, last seen X ago |
That peer isn't connected to Headscale's control plane at all right now. |
active; direct ... |
Live traffic, true peer-to-peer WireGuard connection. |
active; relay "sin", tx/rx ... |
Live traffic, routed through a DERP relay server (here, Singapore) because a direct path couldn't be negotiated — works, just slower. |
Node hygiene: stale Headscale entries¶
Every time a node's local state is wiped and rejoined (step 3 above), it
gets a new machine identity, and Headscale registers it as a brand-new
node rather than recognizing the same physical machine — duplicates like
nuc-a, nuc-a-xllvpuhg, nuc-a-xse9bv3m pile up. Clean up the
stale/offline ones after a reset:
kubectl exec -n headscale headscale-0 -- headscale nodes list
kubectl exec -n headscale headscale-0 -- headscale nodes delete -i <stale-id> --force
online/actively connected; delete the
rest.
Rollout status (as of 2026-09-07)¶
| Node | Reinstalled with safe config? | Notes |
|---|---|---|
mac-mini |
Yes | First validated test — confirmed clean. |
nuc-a |
Yes | Hit the inotify limit issue during setup (see step 1). |
castis-desktop |
Yes | An unrelated, pre-existing broken host-level nginx/RTMP config surfaced during apt install (see "Known non-issues" below); did not block Tailscale's own install. |
nuc-b |
Not yet reset | nuc-b was the original node configured to advertise <OFFICE_LAN_CIDR> per the old headscale/TailscaleClientInstall.md procedure. It has not been through this safe re-setup — its advertised route may still be active/approved in Headscale. Action needed: run headscale nodes list-routes to check, and if still advertising, decide whether to disable the advertisement entirely (recommended, since no node needs to reach this LAN through Tailscale) or, if remote access to the LAN is genuinely needed, leave exactly one node advertising it and ensure no k3s node ever runs with --accept-routes again. |
Known non-issues (encountered during rollout, unrelated to Tailscale)¶
fs.inotify.max_user_instancesexhaustion onnuc-a— fixed via step 1 above; a general k3s node tuning gap, not Tailscale-specific.- Broken host-level
nginx/RTMP config oncastis-desktop— pre-existing, unrelated OS package issue (nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:8) that happened to surface duringapt install tailscalebecause it triggered processing of a backlog of pending package configurations. Does not affect Tailscale or k3s; left as-is pending a decision on whether that RTMP setup is still needed.