homek8s/docs/arm64-runner-dind.md

1101 lines
58 KiB
Markdown
Raw Normal View History

# arm64 Forgejo runners on in-cluster dind — design and measured proof
Status: **cut over 2026-10-27 — read §16 ("As-built") first for what is live,
then §1–§15 for the design and the measurements it was based on.** The design
half was kanban `t_627c231c`: every number in it was measured on `rpi` on
2026-10-27 between 05:30 and 05:55 EDT in the temporary namespace `runner-poc`,
which was deleted afterwards (§2.7). The cutover is `t_0da0a1cc`; §16 records
the applied manifests, the three deviations the cutover forced, the acceptance
evidence, and the executed rollback drill.
**Recommendation: proceed — with three mandatory changes to the manifest, not
just a socket swap.** The deciding number: a real `ci.yml`-shaped Rust job
finished in **27 s wall inside dind vs 28 s on the Pi's host daemon**
(cargo: 25.69 s vs 25.56 s), i.e. **+3.7 % wall-clock, inside the noise of a
4-core Pi** — so dind costs essentially nothing in throughput, and the pod's
**peak RSS was 3.10 GiB**, which is 6× the 512 Mi currently requested and the
first thing that must change. See §15.
---
## 1. What the arm64 runners depend on today
### 1.1 The shared runner (`forgejo/forgejo-runner-arm64`)
`apps/base/forgejo/runner-arm64.yaml`, as deployed and re-verified:
| Dependency | Where | Line |
|---|---|---|
| Host docker socket | `volumes[].hostPath.path: /var/run/docker.sock` | 80–83 |
| …mounted into the runner | `volumeMounts[docker-sock] → /var/run/docker.sock` | 56–57 |
| `DOCKER_HOST=unix:///var/run/docker.sock` | `env` | 49–50 |
| Host's static CLI, `/usr/local/bin/docker-static` | volume 84–87 + mount 58–60 | |
| Host's buildx/compose plugins, `/opt/siriusdevops/runner/cli-plugins` | volume 88–91 + mount 61–63 | |
| `runner.ini` on the Pi host | `/opt/siriusdevops/runner/config/runner.ini` | 95–98 |
| Actions cache on the Pi host | `/opt/siriusdevops/runner/cache` (49 M) | 99–102 |
| The whole `/opt/siriusdevops` hostPath | volume | 103–106 |
| `supplementalGroups: [984]` (host `docker` gid) | pod securityContext | 30–31 |
| Job-container mount of the same socket and CLI | `arm64.toml` `container.options` | configmap 30 |
The identity that must survive: `runner.ini` →
`{"id":6,"uuid":"4e07c1e9-4781-4241-bd8f-d5c10747cbd7","name":"pi-arm64",
"labels":["docker-arm64:…","arm64:…","docker:…"]}` (read live from the Pi host).
### 1.2 The deploy runner (`forgejo/forgejo-runner-deploy-arm64`)
`apps/base/forgejo/runner-deploy-arm64.yaml` — same shape, plus:
| Dependency | Where | Line |
|---|---|---|
| Host docker socket | hostPath | 127–130 |
| Host `docker-static` / `cli-plugins` | volumes 131–138 | |
| `DOCKER_HOST` | env | 100–101 |
| `runner.ini` on a **different** host dir | `/opt/siriusdevops/runner-deploy/data` | 142–145 |
| `deploy-arm64.toml` job options | configmap 55–63 | |
| One-shot self-registration init container (single-use token) | 48–89 | |
Identity: `{"id":14,"uuid":"a41aad73-5b18-4b58-be50-fc8b20807fc9",
"name":"pi-deploy-arm64","labels":["deploy-arm64:docker://node:20-bullseye"]}`.
### 1.3 Named volumes the arm64 CI actually uses
`docker volume ls` on the Pi (33 volumes) and `docker system df -v`, filtered to
CI-owned ones (the rest are `osint-dashboard_*`, `solana-meme-bot-data`,
`websites_registry-data`, `book-data`, … which this migration must not touch):
| Volume | Size | Created by |
|---|---|---|
| `onionwire-target-ci` | **95.82 GB** | `ci.yml:65` `CARGO_TARGET_VOLUME`, mounted at `/target` (`ci.yml:123`) |
| `onionwire-target-ci-fuzz` | 23.96 GB | `fuzz.yml:80` |
| `onionwire-target-ci-sdk` | 17.71 GB | `ci.yml:70` `SDK_CARGO_TARGET_VOLUME`, mounted `ci.yml:193` |
| `onionwire-target-aarch64` | 3.204 GB | `release.yml:246` (aarch64 release job, `runs-on: docker`, line 428) |
| `onionwire-cargo-registry` | 381.1 MB | `ci.yml:63`, `release.yml:64` |
| `onionwire-cargo-registry-fuzz` | 411 MB | `fuzz.yml:39` |
| `GITEA-ACTIONS-TASK-*` (12 ×) | ≤ 450 kB | the runner itself |
| **CI total** | **≈ 141.5 GB** | of the 169.7 GB reported by `docker system df` |
`docker system df` on the Pi, verbatim:
```
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 9 5 4.594GB 2.296GB (49%)
Containers 7 4 1.554GB 1.553GB (99%)
Local Volumes 33 5 169.7GB 48.67GB (28%)
Build Cache 222 0 21.44GB 21.16GB
```
and the four running host containers (unchanged by this card):
```
sirius-growth-site|127.0.0.1:5000/sirius-growth-site:latest|(host net)|Up 4 days
handyman-site|127.0.0.1:5000/handyman-site:latest|127.0.0.1:8082->80/tcp|Up 4 days
garage|dxflrs/garage:v1.1.0|10.10.0.1:3900->3900/tcp, 127.0.0.1:3900-3902->3900-3902/tcp|Up 7 days
registry|registry:2|127.0.0.1:5000->5000/tcp|Up 3 weeks
```
### 1.4 The two couplings that are *not* just "a socket"
Everything else above is mechanical (mount → emptyDir/PVC). These two break
semantics, and they are the real content of the design:
**(a) The Pi registry is bound to loopback only.**
`registry` publishes `127.0.0.1:5000` (`HostIp: 127.0.0.1` in
`docker inspect registry`) and `deploy-site.yml:62-63` does
```
docker build -t 127.0.0.1:5000/sirius-growth-site:latest -f Dockerfile -
docker push 127.0.0.1:5000/sirius-growth-site:latest
```
Inside dind, `127.0.0.1` is the pod, not the Pi. Measured from the POC pod:
```
== A. 127.0.0.1:5000 from dind netns: wget: can't connect to remote host (127.0.0.1): Connection refused
== B. 10.10.0.1:5000 from dind netns: wget: can't connect to remote host (10.10.0.1): Connection refused
```
So `deploy-site.yml`'s Pi-image half **cannot** work from dind unchanged.
Fix (§8): publish the same registry process on `10.10.0.1:5000` as well and
point the workflow at it — the host container keeps pulling
`127.0.0.1:5000/…` from the same registry, so nothing else moves.
**(b) Garage is fine, but only because it is also published on the mesh.**
`deploy-site.yml:117-118` runs `minio/mc` with `--network host` against
`http://127.0.0.1:3900`. Garage *is* published on `10.10.0.1:3900`
(`docker inspect garage`), and from dind with `--network host` (which inside a
dind pod means the pod netns) that address answers:
```
== C. 10.10.0.1:3900 from dind netns: wget: server returned error: HTTP/1.1 403 Forbidden # Garage S3, anonymous denied = alive
== E. sibling container --network host: wget: server returned error: HTTP/1.1 403 Forbidden
```
Only the URL changes: `127.0.0.1:3900` → `10.10.0.1:3900`.
### 1.5 Jobs on the `docker` label — what they actually do
Nothing in onionwire pushes to a registry from the `docker` label; they all use
the daemon directly with named volumes + `docker create/start` + `docker cp`:
| Workflow | Job | `runs-on` | Docker usage |
|---|---|---|---|
| `ci.yml` | `test` | `docker` (74) | volume create, create/start/rm (114–134) |
| `ci.yml` | `sdk` | `docker` (154) | same (184–205) |
| `fuzz.yml` | `fuzz` | `docker` (52) | volume + create/start/rm (63–99) |
| `release.yml` | `aarch64` | `docker` (68) | volumes, `docker cp` out (242–271) |
| `release.yml` | `sign` | `docker` (428) | named volume + `docker cp` (494–523) |
| `arti-watch.yml` | `watch` | `docker` (43) | **no docker at all** — python + crates.io only |
| `android-release.yml` | publish | `docker` (409) | API upload only |
| `android-ci.yml` / `android-release.yml` build jobs | | **`docker-amd64`** (89 / 76) | not arm64 — unaffected |
Correction to the card body: the Android *build* jobs are on `docker-amd64`,
not on `docker`. Only `android-release.yml`'s final publish job is on the arm64
label, and it does not touch the daemon.
`deploy-site.yml` (`sirius-growth`, `runs-on: deploy-arm64`, line 33) is the only
`deploy-arm64` consumer: `docker login`, `docker buildx build --push`
(amd64 cross-build), `docker build` + `push` to `127.0.0.1:5000`, and the
Garage `mc` container.
### 1.6 Disk hygiene is already dind-aware — check the contract, not the file
`apps/base/forgejo/prune-cronjob.yaml` on `master` (since `f1fcf21` /
`58b7ed4`, live as `cronjob/forgejo-runner-prune` with containers
`host-daemon dind-daemons`) already prunes **every** daemon: the Pi host socket
*and* every in-cluster dind, discovered by label — `pods -l app=forgejo-runner`
whose pod has a container named `dind`, pruned over `pods/exec` with the
namespace-scoped `forgejo-prune` ServiceAccount. So the cutover needs **no
prune change at all**, only two naming contracts:
- the new pod keeps label `app: forgejo-runner` (**it already does** —
`runner-arm64.yaml:7-8`), and
- its dind container is named **`dind`** (matching `runner-amd64.yaml:72`).
The old `host-daemon` half becomes a harmless no-op once the arm64 runners stop
using the socket (it prunes nothing and reports `OK`). What *would* silently
break the design is naming the new container anything else — then the prune
discovers nothing and reports success, which is exactly the failure the
`ForgejoPruneCronJobStale` alert was added for.
---
## 2. Measured proof that dind works on this Pi
### 2.1 Pod
Namespace `runner-poc` (labelled `purpose: temporary-arm64-dind-poc`),
`docker:27-dind`, `privileged: true`, `nodeSelector kubernetes.io/hostname: rpi`,
toleration `dedicated=network:PreferNoSchedule`, `dockerd
--host=unix:///var/run/docker.sock --tls=false --mtu=1420`, `/var/run` on an
emptyDir (socket shared with a runner container in the real thing), data-root on
a PVC **pinned to rpi**. Full manifest: comment on `t_627c231c`.
### 2.2 Daemon start
```
$ kubectl -n runner-poc logs dind-poc | grep -E "Docker daemon|API listen"
... msg="Docker daemon" commit=4c9b3b0 containerd-snapshotter=false storage-driver=overlay2 version=27.5.1
... msg="API listen on /var/run/docker.sock"
$ docker network inspect bridge -f '{{json .Options}}'
{"com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1420", …}
$ docker info | head -20
Server Version: 27.5.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Cgroup Version: 2
$ df -hT /var/lib/docker
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 916.5G 486.8G 392.4G 55% /run
```
overlay2 on ext4 (the Pi's only filesystem), MTU 1420 on the bridge — the two
settings the amd64 runner needed for the same reasons.
### 2.3 Pulls
```
pull node:20-bullseye: 15s (952 MB)
pull rust:1.98-bookworm: 30s (1.46 GB)
```
### 2.4 A real build inside dind
`docker buildx build` of the **actual** `sirius-growth` `Dockerfile.cluster`
with the real `site/` + `nginx.cluster.conf`:
```
arm64 build rc=0 wall=12s
#8 [4/4] RUN chmod -R a+rX /usr/share/nginx/html DONE 0.9s
#9 exporting to client directory DONE 2.1s
```
and the deploy runner's cross-build path — `--platform linux/amd64` on an arm64
Pi (QEMU), which is what `deploy-site.yml:55-58` does:
```
amd64 build rc=0 wall=13s
#8 [4/4] RUN chmod -R a+rX /usr/share/nginx/html DONE 1.9s
```
`RUN` under emulation was verified to *really* be x86_64, not a silent
platform substitution, by baking a probe image:
```
$ docker run --rm --platform linux/amd64 poc/archcheck:amd64 cat /arch.txt
x86_64
Linux buildkitsandbox 6.18.39+rpt-rpi-2712 #1 SMP PREEMPT Debian … x86_64 Linux
```
(the Pi's kernel, reported as x86_64 — qemu-user is emulating). Note the POC pod
needed **no** binfmt registration of its own: `/proc/sys/fs/binfmt_misc` inside
the pod is an empty directory, yet emulation works because the registration is
kernel-global on the Pi. That is convenient but it is a *host* dependency the
running runner did not have before — see risk R4.
### 2.5 A representative `ci.yml`-shaped job, inside dind
Same shape as `ci.yml:114-134`: named volumes for the cargo registry and the
target dir, `docker create -i` with `CARGO_TARGET_DIR=/target`,
`TMPDIR=/target/tmp`, source streamed in on stdin, `docker start -a -i`:
```
ci-shaped job wall: 27s rc=0
Compiling regex v1.13.1
Compiling poc-ci v0.1.0 (/src)
Finished `release` profile [optimized] target(s) in 25.69s
```
### 2.6 Peak memory
From the pod cgroup on the node (`memory.peak`, cgroup v2):
```
/sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod<uid>.slice/memory.peak
3329310720 # 3.10 GiB — dockerd + containerd + buildkitd + every nested container
memory.current 1373077504 # 1.28 GiB at idle-ish
```
**3.10 GiB peak vs the 512 Mi the runner Deployment requests today.** A
`limits.memory: 512Mi` on the dind container would OOM-kill it on the first
`docker build`. The amd64 runner already runs `limits.memory: 4Gi` for exactly
this reason (`runner-amd64.yaml:99-104`).
### 2.7 Everything cleaned up
```
$ kubectl -n runner-poc get all,pvc
pod/dind-poc 1/1 Running … pvc/dind-data Bound runner-poc-dind-data 60Gi RWO
$ kubectl delete ns runner-poc --timeout=120s
namespace "runner-poc" deleted
$ kubectl delete pv runner-poc-dind-data --timeout=60s
persistentvolume "runner-poc-dind-data" deleted
$ kubectl get ns | grep -c runner-poc → 0 (namespace gone)
$ kubectl get pv | grep -c runner-poc → 0 (pv gone)
$ ssh rpi sudo rm -rf /opt/local-path-provisioner/runner-poc-dind → removed
$ ssh rpi docker volume ls -q | wc -l → 33 (same as before the POC)
$ ssh rpi docker ps --format '{{.Names}}' → garage handyman-site registry sirius-growth-site
```
The host-daemon comparison (§3) created `poc-ci-host`, `poc-registry-host`,
`poc-target-host` and removed all three; the Pi's volume set is back to 33.
---
## 3. Comparison numbers: dind vs the Pi's host daemon
Both rows are the *same* image, the *same* command string, the *same* 4 cores and
the same cold (freshly created) cargo registry volume. I ran the host row
directly against the host daemon (`docker create/start` over SSH) rather than by
firing a CI job, because that is literally what `forgejo-runner-arm64` does
today — the runner is a thin client for that daemon — and it keeps the CI queue
out of it.
| Load | dind (POC pod on rpi) | host daemon (rpi) | delta |
|---|---|---|---|
| `ci.yml`-shaped Rust job (cold registry, `cargo build --release`) | **27 s** wall / 25.69 s cargo | **28 s** wall / 25.56 s cargo | +3.7 % wall / +0.5 % cargo |
| `Dockerfile.cluster` arm64 buildx build | 12 s | not re-run (host has the same 222-entry build cache; not comparable) | — |
| `Dockerfile.cluster` **amd64 cross** buildx build | 13 s | not measurable on the host without a build-cache write to the shared daemon | — |
| `docker pull node:20-bullseye` | 15 s | n/a (already in the host cache) | — |
| Peak RSS, whole daemon | 3.10 GiB | host daemon is shared, so its RSS is not attributable | — |
The job-shape comparison is the honest one: **dind adds no measurable build
throughput cost.** The env difference that matters is memory (3.10 GiB) and disk
(separate data-root), not CPU.
I did **not** run a full onionwire `ci` (20–40 min) twice; the 25 s cargo leg is
the same code path and the ratio is what the cutover decision needs.
---
## 4. Sizing, with arithmetic
Everything the Pi reports, 2026-10-27 05:50 EDT:
```
/dev/sda2 917G 493G used 387G avail 57% (ext4, the only fs)
Mem: 8062 MB total, 6.7 GB available CPU: 4 cores
rpi allocatable: ephemeral-storage 885686112838 (825 GiB), memory 8153 Mi
dd write (oflag=direct, /opt): 65.2 MB/s
dd read (iflag=direct): 300 MB/s
```
### 4.1 Per-runner data-root
**Shared runner** (`docker-arm64`, `arm64`, `docker`) — must hold, at steady
state:
| Item | Size |
|---|---|
| `onionwire-target-ci` | 95.8 GB |
| `onionwire-target-ci-fuzz` | 24.0 GB |
| `onionwire-target-ci-sdk` | 17.7 GB |
| `onionwire-target-aarch64` | 3.2 GB |
| both cargo registries | 0.8 GB |
| images (rust:1.98-bookworm 1.46 GB + node:20-bullseye 0.95 GB, plus a rollback generation) | ≈ 3.0 GB |
| build cache (this runner does no `docker build`, only `create/start`) | ≈ 2 GB |
| **steady state** | **≈ 146.5 GB** |
**PVC request: 200 GiB** → 27 % headroom (53.5 GiB) over the measured steady
state. The headroom is deliberate: `onionwire-target-ci` reached 95.8 GB by
itself and the amd64 dind taught us a nominally-20Gi data-root grows to ~50 GB
and evicts the node (see §4.4).
**Deploy runner** (`deploy-arm64`) — holds two ~112–143 MB site images, the
buildx `docker-container` driver's own cache (measured 205 MB across the two POC
builds) and a generation of image history:
**PVC request: 40 GiB** — ~10× the measured footprint, sized so a photo-heavy
site rebuild plus a rollback generation never needs a manual prune.
**Total provisioned: 240 GiB against 387 GiB free.** After both runners are warm
(≈ 150 GiB) plus the 26.2 GiB of *non-CI* host volumes nobody is asked to move:
**≈ 211 GiB free (55 %)**. Comfortable.
### 4.2 Migrate or rebuild cold?
| Volume | Size | Verdict |
|---|---|---|
| `onionwire-cargo-registry` (+ `-fuzz`) | 0.79 GB | **copy** — it is pure downloaded crates, ~12 s at 65 MB/s, and saves a crates.io re-download on every cold build |
| `onionwire-target-ci` | 95.8 GB | **rebuild cold** — see below |
| `onionwire-target-ci-sdk` | 17.7 GB | rebuild cold |
| `onionwire-target-ci-fuzz` | 24.0 GB | rebuild cold |
| `onionwire-target-aarch64` | 3.2 GB | rebuild cold |
Copying `onionwire-target-ci` costs **95 820 MB / 65.2 MB/s ≈ 1 470 s ≈ 24.5
minutes** of write-bound Pi I/O, requires both daemons quiesced, and buys back
*one* warm `cargo test` (the 20–40 min job) — while copying a target dir that has
already produced `never executed / os error 13` corruption once. Rebuilding cold
is one unattended CI run per workspace volume and produces a directory that is
guaranteed consistent. Net: **do not migrate the 141 GB of target volumes; migrate
only the 0.8 GB of crate registries.**
### 4.3 Where the PVCs land
Not on the default `local-path` StorageClass — see §6.1. They land on **static
`hostPath` PVs pinned to `rpi`** at
`/opt/local-path-provisioner/forgejo-runner-{arm64,deploy-arm64}`, which is the
same filesystem and the same directory tree the provisioner uses, so `df` and
the existing monitoring see them as ordinary node disk.
### 4.4 The `DiskPressure` lesson, and what stops a repeat here
On rpi, kubelet eviction uses the defaults: `nodefs.available<10 %` →
**DiskPressure at ~825 G used (92 G free)** on a 917 G root; `imagefs` GC starts
at 85 %. Those thresholds are percentages of a huge disk, so they are a
last-resort guard, not a cap — a dind that fills 150 GB is invisible until it is
too late. On siriussec the equivalent threshold was crossed and Forgejo + `pg-1`
went `Pending` for days. What exists today (all live, all GitOps):
1. **The nightly prune already reaches every dind** (`prune-cronjob.yaml`,
`dind-daemons.sh`), with a proven policy: `container prune --filter until=48h`,
`image prune -af --filter until=168h`, a builder-cache cap enforced by
walking the age window down from `--filter until=72h` to `0s` and stopping as
soon as the cache is under the cap (the `--max-used-space` /
`--keep-storage` flags are accepted by buildx 0.20.1 but reclaim **nothing**
here — measured), a `busy()` check that skips a daemon with a live build, and
**`docker volume prune` is forbidden** so `onionwire-target-ci` survives.
Requirement for the cutover: name the container `dind` and keep
`app: forgejo-runner` (§1.6).
2. **The alerts are node-scoped, because per-PVC bytes do not exist.** The old
`RunnerDindPvcHighWatermark` / `RunnerDindPvcCritical` pair was **deleted** —
it selected `kubelet_volume_stats_*`, which kubelet 1.34+ no longer exports at
all (`/metrics/volumes` 404s on every node here; upstream
kubernetes/kubernetes#133847), so it could never fire for *any* volume type,
hostPath or not. `monitoring/controllers/home/prune-alerts.yaml` instead ships
two complementary node-filesystem guards, both on the disk that holds the
dind data-root:
- `dind-disk-cap` → `RpiDindDataRootFillingUp` (**> 70 %** on rpi), which landed
with the arm64 cutover: 70 % of 917 G still leaves the room to run the prune
job, and a static PV does not enforce its claim;
- `forgejo-prune` → `RunnerDindDiskHighWatermark` (**> 80 %**) and
`RunnerDindDiskCritical` (**> 90 %**) on every *other* node that runs a
`forgejo-runner` pod (i.e. siriussec; `nodename!="rpi"` keeps the Pi from
being paged twice) with the runner-specific runbook.
Both sit inside `NodeFilesystemFillingUp` (**> 85 %**) / `NodeFilesystemCritical`
(**> 92 %**), which still cover every node as the backstop.
3. **A dedicated data-root per runner** (200 GiB + 40 GiB PVCs) so a runaway
cache cannot touch the 26 GB of unrelated host volumes on the same disk, and
so `docker system df -v` inside each pod attributes growth to one runner.
---
## 5. Target architecture
Two arm64 runners, mirrors of each other, each a **two-container pod** — exactly
the shape `forgejo-runner-amd64` already runs:
```
Deployment forgejo-runner-arm64 node rpi, PVC forgejo-runner-arm64-dind (200Gi)
├── container dind docker:27-dind, privileged
│ dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420
│ /var/lib/docker ← PVC
│ /var/run ← emptyDir (socket)
└── container runner code.forgejo.org/forgejo/runner:5.0.1, runAsUser 0
DOCKER_HOST=unix:///var/run/docker.sock
/var/run ← emptyDir (same socket)
/data ← PVC (runner.ini + actions cache + everything else)
/config/config.toml ← ConfigMap arm64.toml
Deployment forgejo-runner-deploy-arm64 node rpi, PVC forgejo-runner-deploy-arm64-dind (40Gi)
└── same two containers, deploy-arm64.toml, label `deploy-arm64` ONLY
```
Labels, verbatim, unchanged:
| Runner | Labels | `capacity` |
|---|---|---|
| `forgejo-runner-arm64` | `docker-arm64:docker://node:20-bullseye`, `arm64:docker://node:20-bullseye`, `docker:docker://node:20-bullseye` | 1 |
| `forgejo-runner-deploy-arm64` | `deploy-arm64:docker://node:20-bullseye` | 1 |
Not merged, not shared, and `docker` still never reaches the amd64 runner.
---
## 6. Manifest / config changes
### 6.1 Storage: static PVs, not dynamic `local-path`
**A dynamic `local-path` PVC whose consumer is on rpi hangs forever in this
cluster.** Measured, in the POC:
```
$ kubectl -n runner-poc describe pvc dind-data | tail -3
Normal Provisioning External provisioner is provisioning volume for claim "runner-poc/dind-data"
$ kubectl -n local-path-storage describe pod helper-pod-create-pvc-… | grep -A2 Events
Warning NodeAffinity kubelet Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector
$ kubectl -n local-path-storage get pod helper-pod-create-pvc-… -o yaml | grep -A1 nodeSelector
nodeSelector:
kubernetes.io/hostname: siriussec
```
Cause: `infrastructure/storage/local-path-storage.yaml:158-159` hardcodes the
helper-pod nodeSelector to `siriussec`, and for a local (non-shared) filesystem
the provisioner never sets `spec.nodeName` on the helper pod — so the helper can
only ever run on siriussec and the PV is never created. Every one of the 6
existing `local-path` PVCs happens to live on siriussec, which is why nobody hit
this before.
**Therefore: two static PVs pinned to rpi.** Proven working in the POC
(`pvc/dind-data Bound runner-poc-dind-data 60Gi RWO`) with:
```yaml
kind: PersistentVolume
metadata: {name: forgejo-runner-arm64-dind}
spec:
capacity: {storage: 200Gi}
accessModes: [ReadWriteOnce]
persistentVolumeReclaimPolicy: Retain # never Delete: losing runner.ini loses the uuid
storageClassName: local-static
hostPath: {path: /opt/local-path-provisioner/forgejo-runner-arm64-dind, type: DirectoryOrCreate}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- {key: kubernetes.io/hostname, operator: In, values: [rpi]}
```
plus a small `StorageClass local-static` with **no provisioner**
(`provisioner: kubernetes.io/no-provisioner`, `volumeBindingMode: WaitForFirstConsumer`)
and PVCs with `storageClassName: local-static`, `volumeName:` pinned.
`Retain` matters: a re-provisioned PV would silently produce a runner with a new
uuid.
*Alternative considered and rejected for now*: drop the nodeSelector at
`local-path-storage.yaml:158` and add `rpi` to `nodePathMap`. It is GitOps-able,
but the helper pod would then be schedulable anywhere while the PV is pinned to
rpi — the `mkdir` and the ownership land on whichever node wins the race. Fixing
shared storage infrastructure to unblock two pods is the wrong blast radius.
### 6.2 `arm64.toml`
```diff
runner:
file: /config/runner.ini
capacity: 1
@@
- cache: /opt/siriusdevops/runner/cache
+ cache: /data/cache
cache:
enabled: true
- dir: /opt/siriusdevops/runner/cache
+ dir: /data/cache
container:
privileged: true
- # No docker_host: …
- options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g
+ # No docker_host: the socket bind below is the only one (see §7.2).
+ # The CLI comes from the dind container's own filesystem (see §7.1).
+ options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g
valid_volumes:
- "**"
```
`deploy-arm64.toml` gets the identical change to `options`, and
`file:`/`cache:`/`dir:` move from `/data/...` (hostPath) to the same `/data/...`
(PVC) — the paths do not change, only the volume behind them.
### 6.3 Deployment diff (both runners)
Removed: `volume docker-sock (hostPath /var/run/docker.sock)`,
`volume docker-static (hostPath /usr/local/bin/docker-static)`,
`volume cli-plugins (hostPath …/cli-plugins)`, `volume siriusdevops
(hostPath /opt/siriusdevops)`, `volume runner-ini (hostPath …)`,
`volume cache (hostPath …)`, `volume data (hostPath …)`,
`securityContext.supplementalGroups: [984]`, and the runner container's
`privileged: true` + `runAsGroup: 0` (keep `runAsUser: 0` — the amd64 runner
proved the uid-1000/dind-socket race).
Added: container `dind` (privileged, `--mtu=1420`, `/var/lib/docker` on the PVC,
`/var/run` on the emptyDir, `limits.memory: 4Gi`), `volume dind-run (emptyDir)`,
`volume data (PVC)`, and a `wait for the socket` shim on the runner so it does not
`BackOff` on a cold start (copy `runner-amd64.yaml:116-129`).
Kept: `strategy: Recreate` (RWO PVC), `nodeSelector rpi`, the
`dedicated=network:PreferNoSchedule` toleration, `capacity: 1`, the label sets.
### 6.4 `runner.ini`: hostPath → PVC, identity preserved
Both runners already have a registration; neither may re-register:
| Runner | id | uuid | name |
|---|---|---|---|
| shared | 6 | `4e07c1e9-4781-4241-bd8f-d5c10747cbd7` | `pi-arm64` |
| deploy | 14 | `a41aad73-5b18-4b58-be50-fc8b20807fc9` | `pi-deploy-arm64` |
Cutover must **copy** the file, never let a register step run:
```
# shared: /opt/siriusdevops/runner/config/runner.ini → PV dir on rpi
ssh rpi 'sudo install -m 600 -o root -g root \
/opt/siriusdevops/runner/config/runner.ini \
/opt/local-path-provisioner/forgejo-runner-arm64-dind/runner.ini'
# deploy: /opt/siriusdevops/runner-deploy/data/runner.ini → its PV dir
ssh rpi 'sudo install -m 600 -o root -g root \
/opt/siriusdevops/runner-deploy/data/runner.ini \
/opt/local-path-provisioner/forgejo-runner-deploy-arm64-dind/runner.ini'
```
The deploy runner's init container must be **inverted** into a guard, or it will
burn the single-use token and create `id: 15` alongside `id: 14`:
```
- name: require-registration
command: [sh, -c, 'test -s /data/runner.ini || { echo "runner.ini missing — refusing to register a second uuid"; exit 1; }']
```
…and `/data/runner.ini` must be the *runner* container's path (`/data` on the
PVC), so `arm64.toml`'s `runner.file: /config/runner.ini` becomes
`/data/runner.ini` for the shared runner as well (one less bind, one less
difference between the two runners).
---
## 7. How the docker CLI reaches the jobs
### 7.1 Bind it out of the dind image (chosen)
`docker:27-dind` already contains the client and the plugins:
```
$ kubectl -n forgejo exec deploy/forgejo-runner-amd64 -c dind -- sh -c 'command -v docker; ls /usr/local/libexec/docker/cli-plugins/'
/usr/local/bin/docker
docker-buildx
docker-compose
```
So `container.options` binds `-v /usr/local/bin/docker:/usr/bin/docker:ro` and
`-v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro`
(the daemon resolves both paths in the dind container, where they exist). The
second bind is what keeps `docker buildx` working for `deploy-site.yml:55`.
Why not the amd64 runner's "install a static CLI in the job" approach: five
onionwire workflows plus `deploy-site.yml` call `docker` on their first line and
rely on the CLI being there today. Making them each fetch a 40 MB tarball adds a
network round-trip to every job (and one that has been seen to stall for 300 s
through Cloudflare), for no benefit — the dind image *is* the matching client for
the daemon it talks to. Jobs that want their own client still can.
### 7.2 Socket injection: the `options` bind, never `docker_host`
`arm64.toml` keeps the explicit `-v /var/run/docker.sock:/var/run/docker.sock`
and **no `container.docker_host`**. Setting both produces
`Duplicate mount point: /var/run/docker.sock` on every job (proven before, and
still true). This is also the one the nested-`docker run` in `ci.yml`/`fuzz.yml`
depends on. The socket lives in a shared `emptyDir` at `/var/run`, `chmod 666`
by the dind container, exactly as on the amd64 runner.
### 7.3 MTU, cgroup, storage driver
| Setting | Value | Why |
|---|---|---|
| `--mtu=1420` | pod eth0 MTU | Cilium native routing over WireGuard leaves 1420; a 1500 docker bridge makes pulls and large fetches stall intermittently. Verified in the POC bridge options. |
| `--host=unix:///var/run/docker.sock --tls=false` | socket only | never `-H tcp://0.0.0.0:2375`: that publishes an unauthenticated API on the pod IP. |
| storage driver | overlay2 (auto) | `Backing Filesystem: extfs` on `/dev/sda2`; verified in the POC. No `--storage-opt`, no zfs/btrfs. |
| cgroup driver | cgroupfs (in-pod default) | same as the amd64 runner; the pod's own limits are the only accounting boundary — nested containers are not visible to the kubelet, hence §4.4's file-system alert rather than a pod-level cap. |
| `--iptables` | default (true) | port publishing inside the dind daemon is used by nothing today; leave it. |
---
## 8. Registry access from inside dind
| Path | Today | From dind | Verdict |
|---|---|---|---|
| `forgejo.siriusdevops.com` (public registry, `deploy-site.yml:54-58`, `siriusdevops-contact`) | works | **works** — `wget https://forgejo.siriusdevops.com/v2/` → `HTTP/1.1 401` (auth challenge), and `docker pull forgejo.siriusdevops.com/sirius/sirius-growth-site:latest` reached manifest resolution (`no matching manifest for linux/arm64/v8`) | no change |
| Pi registry `127.0.0.1:5000` (`deploy-site.yml:62-63`) | works | **broken** — connection refused | publish the same registry on `10.10.0.1:5000` and change the workflow to `10.10.0.1:5000/sirius-growth-site:latest` |
| Garage `127.0.0.1:3900` (`deploy-site.yml:118`) | works | `10.10.0.1:3900` answers (403 anonymous) | change the URL only |
The registry change is one line in the Pi's compose (`/home/sirius/websites/docker-compose.yml`,
project `websites`, container `registry`, currently
`ports: ["127.0.0.1:5000:5000"]` → add `"10.10.0.1:5000:5000"`). The host
container `sirius-growth-site` keeps pulling `127.0.0.1:5000/…` from the same
process, so nothing else moves. **This is card 2's change and must land before
the deploy runner is migrated**; without it the Pi-image half of `deploy-site`
fails and the host container silently stays on the old image.
---
## 9. Cache strategy
| Cache | Today | After |
|---|---|---|
| actions cache (`runner.cache`, 49 MB) | hostPath `/opt/siriusdevops/runner/cache` | `/data/cache` on the runner's PVC |
| cargo registry (0.79 GB) | host volumes | **copied** into dind (`docker run --rm -v …` + `tar` from a host-mounted read of the old volume — local copy, ~12 s) |
| cargo target dirs (141 GB) | host volumes | **cold**; regrow in place, one long CI run each |
| buildx `docker-container` builder cache (deploy runner) | host build cache (21.4 GB, shared) | inside the dind data-root; the nightly prune keeps 20 GB |
Cold-rebuild cost per volume, stated honestly: `onionwire-target-ci` from empty
is a 20–40 min `ci` job on this Pi; the SDK and fuzz volumes are shorter. That
is a **one-off**, and it replaces a 24.5-minute blocking copy of 95.8 GB plus the
risk of migrating a target dir that has already caused `os error 13` corruption.
---
## 10. Cutover steps (card 2 executes)
Pre-flight — every one is read-only and proves the next step:
1. `kubectl -n forgejo get deploy,pvc` and `ssh rpi docker ps` — record before.
2. Confirm `onionwire`'s in-flight work: no `running` run on the `docker` label
(`action_task`), or accept that the cutover kills it (see §14).
3. Publish the Pi registry on `10.10.0.1:5000` and prove
`curl -s http://10.10.0.1:5000/v2/` → `{}` from a pod.
4. Create the two static PVs + `local-static` StorageClass + PVCs; prove both
`Bound` before any pod references them.
5. `sudo mkdir -p` both PV dirs on rpi, copy the two `runner.ini` files (§6.4),
`chown root:root`, mode 600, and `ls -l` both.
Cutover — shared runner first (it owns `docker`):
6. `kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=0`, then
`ssh rpi docker ps --filter name=GITEA-ACTIONS` and `docker kill`/`rm` any
job containers **still running on the host daemon** (a Deployment restart does
not stop them; they keep writing to the volumes we are about to abandon).
7. Copy the two cargo registry volumes into the new dind, in the *same* pod that
will serve them, before the runner starts:
`kubectl cp` is not needed — mount the host's
`/var/lib/docker/volumes` read-only into a one-shot debug pod on rpi and
`docker cp`/`tar` it into the dind data-root (local I/O, ~12 s).
8. Apply the new `runner-arm64.yaml` (GitOps commit → Flux reconcile, or
`kubectl apply` first and commit in the same minute — pick one and say which).
9. Wait for `2/2 Running`, then in the dind container:
`docker version` (server = 27.5.1), `docker info | grep -i mtu`,
`docker volume ls` (registry present), and in the runner:
`tail /proc/1/…` — the log must show `declared successfully` +
`[poller N] launched`, and Forgejo's `action_runner.last_online` must move
for **id 6 / uuid 4e07c1e9…** (a new uuid = the registration was lost, stop).
10. Dispatch `onionwire` `ci.yml` on a branch (`workflow_dispatch`,
`POST /api/v1/repos/sirius/onionwire/actions/workflows/ci.yml/dispatches
{"ref": "<branch>"}`), and prove from the job log that both jobs ran against
the **dind** server (`docker version` inside the job), duration similar to
§3, and `action_task` row pointing at runner id 6.
11. Repeat 6–9 for `forgejo-runner-deploy-arm64` (id 14 / uuid `a41aad73…`),
then one `deploy-site` run on `runs-on: deploy-arm64` and prove the image
landed in the Pi registry (`curl -s http://10.10.0.1:5000/v2/_catalog`) and
the Garage sync succeeded.
12. Prove the existing prune discovers the new pod before trusting the night:
`kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)`
and check its `dind-daemons` container log lists both new pods (label +
container-name contract, §1.6) and reports `docker system df` per daemon.
13. `df -h /` on rpi before/after, `kubectl -n forgejo get pvc` (both Bound),
`kubectl get deploy -n forgejo -o wide`.
## 11. Rollback
Kept in place for this purpose, and none of it is deleted by the cutover:
- `runner.ini` stays at `/opt/siriusdevops/runner/config/runner.ini` and
`/opt/siriusdevops/runner-deploy/data/runner.ini` (we *copy*, never move).
- The old manifests are one `git revert` away; the PVCs and PVs are additive.
- The host-Docker volumes (`onionwire-target-ci` etc.) are **not** deleted —
only abandoned. If the cutover is reverted, the old runner finds its warm
caches again.
- The compose runner on the Pi is already stopped; it must stay stopped (two
daemons on one uuid double-poll).
Rollback, ~5 minutes:
```
kubectl -n forgejo apply -f <git show HEAD~1:apps/base/forgejo/runner-arm64.yaml>
kubectl -n forgejo apply -f <git show HEAD~1:apps/base/forgejo/runner-deploy-arm64.yaml>
kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=1
```
(down the dind deployment first, kill any job container inside dind, then apply.)
Verify: pod `1/1 Running` on rpi, `action_runner.last_online` current for ids 6
and 14, and the host daemon shows `docker ps` job containers again during a job.
The new PVCs/PVs can stay (they cost nothing when unused) or be deleted with the
dind Deployments.
---
## 12. Risk table
| # | Risk | Severity | Mitigation | Residual |
|---|---|---|---|---|
| R1 | Registration lost → new uuid, two runners polling | high | copy `runner.ini` before start, `Retain` reclaim policy, verify uuid in logs *and* in `action_runner` | a `kubectl delete pv` still loses it; it lives in exactly one place, like today |
| R2 | dind data-root fills the Pi's only filesystem | high (it took Forgejo down once on siriussec) | 200 Gi/40 Gi PVCs, in-pod nightly prune, node-fs alert at 70 % | **not fully eliminated** — `local-path` does not enforce a request; the alert is the cap |
| R3 | Memory: 3.10 GiB peak vs today's 512 Mi | high | `limits.memory: 4Gi` on dind (amd64 precedent), requests 512Mi | on an 8 GB Pi two runners × 4 GiB limits can thrash if both build at once; `capacity: 1` each bounds it, but nothing bounds *both* runners together |
| R4 | amd64 cross-build currently works without an in-pod binfmt registration | medium | proven working twice (§2.4); re-verify after any kernel/dockerd/image bump | if the Pi's qemu binfmt registration is ever removed, `deploy-site`'s amd64 half breaks *silently differently* than today (today the host daemon would break too, but with a different message) |
| R5 | Pi registry reachable only on loopback | high for the deploy runner | publish on `10.10.0.1:5000` (§8) | depends on a Pi compose change that is outside this card |
| R6 | Job containers orphaned on the host daemon during cutover | medium | kill them explicitly before scaling down (§10.6); a restart does not stop them | a killed job leaves a partial artefact in the old volumes — abandoned anyway |
| R7 | `local-path` helper pod cannot provision on rpi | high (blocks the whole plan) | static PVs (§6.1), proven in the POC | two more hand-made PVs to keep in the repo; a future node change does not re-derive them |
| R8 | Cold `onionwire-target-ci` after cutover | low | accept; one long CI run | the first post-cutover `ci` is slow and may re-trigger the `os error 13` volume race if `capacity ≠ 1` — so keep 1 |
| R9 | Pull/latency regressions from MTU | low | `--mtu=1420` proven; pull 30 s for 1.46 GB | none observed |
| R10 | The prune silently skipping the new dind | medium, silent | it discovers `app=forgejo-runner` pods with a container named `dind` — naming contract in §1.6, proven with a manual Job in §10.12; `ForgejoPruneCronJobStale` fires on a stale last-success | a pod that renames the container looks pruned and is not |
---
## 13. CI impact list (exact files)
| Repo / file | Change | Why |
|---|---|---|
| `onionwire/.forgejo/workflows/ci.yml` | **none required** | CLI comes from the dind image; volume names/paths unchanged |
| `onionwire/.forgejo/workflows/fuzz.yml` | **none** | same |
| `onionwire/.forgejo/workflows/release.yml` | **none** | same (`docker cp`/volume pattern is daemon-agnostic) |
| `onionwire/.forgejo/workflows/arti-watch.yml` | **none** | no docker use at all |
| `onionwire/.forgejo/workflows/android-{ci,release}.yml` | **none** | they run on `docker-amd64`; `docker`-labelled publish job does no docker work |
| `sirius-growth/.forgejo/workflows/deploy-site.yml` | **2 lines**: `127.0.0.1:5000` → `10.10.0.1:5000` (62–63); `127.0.0.1:3900` → `10.10.0.1:3900` (118) | §1.4 |
| `siriusdevops-contact/.forgejo/workflows/deploy.yml` | **none** | already `docker-amd64` |
| `homek8s/apps/base/forgejo/runner-arm64.yaml` | dind rewrite (§6.3) | |
| `homek8s/apps/base/forgejo/runner-deploy-arm64.yaml` | dind rewrite + guarded init container | |
| `homek8s/apps/base/forgejo/runner-configmap.yaml` | `arm64.toml`/`deploy-arm64.toml` (§6.2) | |
| `homek8s/apps/base/forgejo/prune-cronjob.yaml` | **no change** — it already prunes every dind by label; only the naming contract matters (`app=forgejo-runner` + a container named `dind`) | §1.6 |
| `homek8s/monitoring/controllers/home/prune-alerts.yaml` | **already done**: `RpiDindDataRootFillingUp` (rpi, 70 %) plus `RunnerDindDisk*` (80 % / 90 %, other runner nodes) | §4.4 |
| `homek8s/apps/base/forgejo/{pv,pvc}.yaml` (new) | 2 PVs, 2 PVCs, `local-static` SC | §6.1 |
| Pi `/home/sirius/websites/docker-compose.yml` | add `10.10.0.1:5000:5000` to `registry` | §8 |
**In-flight runs during cutover:** scaling the Deployment to 0 does **not** kill
the job containers already running on the host daemon, and Forgejo has no
cancel endpoint — the run stays `running` until its job container dies. So:
check `action_task` first, and if a run is live either wait (a `ci` run is 20–40
min) or `docker kill` it and accept a `cancelled` run. Queued runs simply stay
`waiting` and are picked up by the new runner. Nothing is lost except the run
that was killed, and its work is being abandoned anyway (§11).
---
## 14. What this design does **not** fix
- Two arm64 runners still share one 8 GB / 4-core Pi; `capacity: 1` each means
two concurrent heavy jobs are still possible (one per runner). Unchanged.
- The `docker` label stays arm64-only, so all the Rust CI remains on the Pi.
- The Pi's root filesystem is still the only place CI data can live (no
second disk), so R2 is a monitoring problem, not a solved one.
---
## 15. Recommendation
**Proceed — with changes.** The socket swap itself is sound: a real
`ci.yml`-shaped Rust job ran in **27 s in dind vs 28 s on the host daemon**
(cargo 25.69 s vs 25.56 s), pulls are 15–30 s, and a real
`docker build` plus an amd64 cross-build both succeed inside the pod on this Pi,
so the migration costs no measurable throughput and finally gives each runner its
own data-root, its own accounting boundary in the cluster, and a rollback that is
a `git revert`. Three things must change with the socket, not after it:
**(1) `limits.memory: 4Gi` on the dind container** — measured peak RSS was
**3.10 GiB**, six times today's 512 Mi, and a 512 Mi limit OOM-kills the daemon
on the first build; **(2) static PVs pinned to rpi instead of dynamic
`local-path`**, because the provisioner's helper pod is hardcoded to siriussec
and a `local-path` PVC for an rpi pod never binds; and **(3) the Pi registry must
also publish on `10.10.0.1:5000`**, because `deploy-site.yml`'s Pi-image push
targets loopback and gets `Connection refused` from inside dind. Disk is not the
constraint (240 GiB of 387 GiB free, 146.5 GiB measured steady state); the
constraint is that a static PV does not enforce that 240 GiB either — the nightly
prune already reaches dind daemons by label (so it needs no change, only the
`dind` container name), and rpi's root filesystem is capped by
`RpiDindDataRootFillingUp` at 70 % (`dind-disk-cap` group) — per-PVC bytes are
simply not exported by kubelet 1.34+, so the filesystem is the only honest
measure.
---
## 16. As-built (cutover executed 2026-10-27, kanban `t_0da0a1cc`)
Status: **cut over and verified in production.** Both arm64 runners execute
their job containers against an in-pod `docker:27-dind`; the Pi's host Docker is
no longer a job-container daemon for either. This section records what landed,
every deviation from §6/§15 with the evidence that forced it, the acceptance
output, and the rollback that was executed.
### 16.1 What changed, per file
| File | Change |
|---|---|
| `apps/base/forgejo/runner-arm64.yaml` | two-container pod (`dind` + `runner`); **zero hostPath**; `/data` on PVC, `/var/run` on emptyDir; dind `--mtu=1420 --insecure-registry=10.10.0.1:5000`, `limits.memory: 4Gi`; runner `runAsUser: 0` + socket-wait shim; `supplementalGroups: [984]` and the runner's `privileged: true`/`runAsGroup: 0` removed |
| `apps/base/forgejo/runner-deploy-arm64.yaml` | same shape; dind `limits.memory: 2Gi`; the `register` init container is replaced by `require-registration`, which exits 1 when `/data/runner.ini` is missing instead of burning a single-use token and creating a second `action_runner` row |
| `apps/base/forgejo/runner-dind-storage.yaml` (new) | `StorageClass local-static` (`kubernetes.io/no-provisioner`, `WaitForFirstConsumer`, `Retain`), PV+PVC `forgejo-runner-arm64-dind` 200Gi and `forgejo-runner-deploy-arm64-dind` 40Gi, `hostPath` under `/opt/local-path-provisioner/`, `nodeAffinity` to `rpi` |
| `apps/base/forgejo/runner-configmap.yaml` | `arm64.toml`: `runner.file: /data/runner.ini`, `cache: /data/cache`, CLI/plugins bound out of the dind image; `deploy-arm64.toml`: same options, comments corrected (no host socket, no host CLI) |
| `apps/base/forgejo/kustomization.yaml` | lists the storage file before the Deployments |
| `monitoring/controllers/home/prune-alerts.yaml` | new group `dind-disk-cap`, alert `RpiDindDataRootFillingUp` at **70 %** of rpi's `/` |
| Pi `/home/sirius/websites/docker-compose.yml` | `registry` publishes `10.10.0.1:5000:5000` **in addition to** `127.0.0.1:5000:5000`; backup `docker-compose.yml.orig-20261027-registry-wg` |
| `sirius/sirius-growth` `.forgejo/workflows/deploy-site.yml` | Pi-image push `127.0.0.1:5000` → `10.10.0.1:5000`; Garage endpoint `127.0.0.1:3900` → `10.10.0.1:3900` |
Labels, verbatim and unchanged: shared `docker-arm64`, `arm64`, `docker` (all
`docker://node:20-bullseye`); deploy `deploy-arm64` only. `capacity = 1` on both.
The `dind` container is named exactly `dind` (§1.6 naming contract).
### 16.2 Deviations from the design, and why
1. **`--insecure-registry=10.10.0.1:5000` on both runners' dockerd.** §8 assumed
publishing the registry on the WG address was enough. It is not: Docker only
treats `127.0.0.0/8` as insecure by default, so the first post-cutover
`deploy-site` run (task 1732) built the Pi image fine and then died pushing it:
```
#8 naming to 10.10.0.1:5000/***-growth-site:latest 0.0s done
The push refers to repository [10.10.0.1:5000/***-growth-site]
Get "https://10.10.0.1:5000/v2/": http: server gave HTTP response to HTTPS client
🏁 Job failed
```
Fixed on the daemon, not in the job image, so no workflow needs to know.
Proof afterwards: `docker info` inside each dind reports
`{"10.10.0.1:5000":{"Name":"10.10.0.1:5000","Secure":false,…}}` and the
re-run pushed `latest: digest: sha256:a819dc91…`.
2. **Deploy runner dind limit is `2Gi`, not a copy of the amd64 runner's 4Gi.**
§15 left the number open. The Pi has ~7.0 GiB available and `capacity = 1`
bounds each runner but nothing bounds *both*: two 4 GiB limits would let a
`ci` run and a deploy claim every byte of the box. A deploy is two nginx-based
site images (112–143 MB) plus buildx's container driver and one amd64
cross-build — nothing like the Rust job that measured 3.10 GiB. 4 GiB + 2 GiB
leaves ~1 GiB for kubelet/Cilium/cloudflared/host Docker in the overlap case,
and an OOM here fails one deploy *visibly*.
3. **Measured pod MTU is 1500, not 1420.** `ip link show eth0` in the new pod
reports `mtu 1500` on rpi (the pod's default route leaves over the LAN
interface, not `wg0`). `--mtu=1420` is kept: it is below every path MTU this
pod uses, matches the amd64 runner, and the bridge really is 1420
(`docker network inspect bridge` → `"com.docker.network.driver.mtu":"1420"`).
4. **`runner.ini` at `/data/runner.ini` for both runners** (§6.4), copied from the
Pi host with `install -m 600 -o root -g root` *before* the first pod start.
Identity survived: uuid `4e07c1e9-4781-4241-bd8f-d5c10747cbd7` (action_runner
id 6 — its **name in the Forgejo DB is `pi-runner`**, not the `pi-arm64` the
ini file carries; the row was renamed historically) and
`a41aad73-5b18-4b58-be50-fc8b20807fc9` (id 14). No row was created, none was
orphaned: `action_runner` still has exactly three rows after the cutover.
5. **The card's `grep -c docker.sock` = 0 acceptance cannot literally hold.** With
an in-pod daemon the socket is still `unix:///var/run/docker.sock` (in
`DOCKER_HOST`, the shim, and `container.options`), so the string appears 5×
per Deployment. The meaningful test is **no hostPath at all**:
`kubectl -n forgejo get deploy <n> -o yaml | grep -c hostPath` = 0 for both,
and every `docker.sock` reference resolves to the `emptyDir` shared by the
`dind` and `runner` containers.
6. **One in-flight CI job was killed by the `--insecure-registry` reconcile.**
`ci.yml` run 1192's second job (`sdk`, task 1734) had started at 06:53 and the
pod restart at 06:56 killed its container, leaving the task `running` with no
container and the run holding the workflow's concurrency group. Cleared the
dead rows (`action_task` 1734 → status 3, `action_run` 1192 → status 3; the
same rows the Forgejo UI would mark cancelled, since Forgejo exposes no cancel
endpoint) and re-dispatched. Proof run: `ci.yml` run **1197** — `test` task
1737 green in **1782 s** (29m42s, warm `onionwire-target-ci`; the cold first
run was 3017 s) and `sdk` task 1738 green in **791 s** (13m11s — that job has
its own `onionwire-target-ci-sdk` volume, which was cold).
**Cancelling a *queued* run in the DB does not stick.** Two extra
`ci.yml` dispatches queued behind the workflow's concurrency group
(`action_run.status = 5`); setting `status = 3` on a waiting row is undone the
next time Forgejo's scheduler wakes the queue, and the run then starts for
real. Kill it only once it is `status = 6` (running) with a dead task — i.e.
cancel the *task* first (set `action_task.status = 3` and its
`action_task_step` rows to 3), then the run. Runs 1192/1197/1198 are all
resolved that way and `select count(*) from action_run where status in (5,6)`
is now **0**.
### 16.3 Acceptance evidence (all pasted from the live cluster)
PVCs bound on rpi, static, `Retain`:
```
$ kubectl -n forgejo get pvc -o wide | grep dind
forgejo-runner-arm64-dind Bound forgejo-runner-arm64-dind 200Gi RWO local-static
forgejo-runner-deploy-arm64-dind Bound forgejo-runner-deploy-arm64-dind 40Gi RWO local-static
$ kubectl get pv forgejo-runner-arm64-dind forgejo-runner-deploy-arm64-dind
NAME CAPACITY RECLAIM POLICY STATUS CLAIM
forgejo-runner-arm64-dind 200Gi Retain Bound forgejo/forgejo-runner-arm64-dind
forgejo-runner-deploy-arm64-dind 40Gi Retain Bound forgejo/forgejo-runner-deploy-arm64-dind
```
Pods on rpi, two containers each, daemon `27.5.1` (the dind image — the Pi host
daemon is `29.7.2`, so a job can never be talking to it):
```
$ kubectl -n forgejo get deploy -o wide
forgejo-runner-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1
forgejo-runner-deploy-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1
$ kubectl -n forgejo exec <arm64-pod> -c dind -- docker version --format 'server={{.Server.Version}}'
server=27.5.1
```
Registration identity, preserved, `last_online` current, no duplicates:
```
$ psql -Atc "select id,uuid,name,last_online,agent_labels from action_runner order by id"
6 |4e07c1e9-4781-4241-bd8f-d5c10747cbd7|pi-runner |1793080953|["docker-arm64","arm64","docker"]
8 |91124ee3-f344-44cf-9a07-11d6379549e8|siriussec-amd64 |1793080953|["docker-amd64","amd64"]
14|a41aad73-5b18-4b58-be50-fc8b20807fc9|pi-deploy-arm64 |1793080953|["deploy-arm64"]
```
Real jobs on the new runner ids — shared runner (`ci.yml`, `runs-on: docker`,
arm64): task 1731 green in 3017 s (cold `onionwire-target-ci`), then the rerun
task 1737 in 1782 s (warm); deploy runner: task 1736 (`deploy-site.yml`) green in
**48 s**, every step success, including the Pi-registry push and the Garage sync:
```
115 … #8 naming to 10.10.0.1:5000/***-growth-site:latest 0.0s done
174 … The push refers to repository [10.10.0.1:5000/***-growth-site]
203 … latest: digest: sha256:a819dc91cc3a2630cc355a40e8b5e5850879d0e429dd4c497572ae22446951cb size: 2619
257 … upload: ../photos/scope/scope-market-1200.webp to s3://***-growth-photos/scope/scope-market-1200.webp
299 … 🏁 Job succeeded
```
Nightly prune reaches both new daemons (R10 proof, forced Job):
```
$ kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-1793084490
$ kubectl -n forgejo logs job/prune-manual-1793084490 -c dind-daemons | grep -E "daemon: dind in pod/|summary:"
== daemon: dind in pod/forgejo-runner-amd64-f7bb99fb-mbv5f
== daemon: dind in pod/forgejo-runner-arm64-7c84998bb8-mmwqd
== daemon: dind in pod/forgejo-runner-deploy-arm64-5dcbd9f7fc-6nj2g
summary: dind daemons found=3 pruned=3 skipped=0 failed=0
```
Pi registry scoped correctly (WG hub + loopback only; LAN and public closed):
```
$ ssh rpi 'ss -lntH "sport = :5000"'
LISTEN 0 4096 10.10.0.1:5000 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:5000 0.0.0.0:*
$ ssh rpi 'curl -m5 -o /dev/null -w "%{http_code}" http://192.168.1.125:5000/v2/' → 000 (refused)
$ kubectl -n forgejo exec <arm64-pod> -c dind -- wget -qO- http://10.10.0.1:5000/v2/
{} # from the job daemon itself
```
Disk guard live in Prometheus:
```
$ curl -s localhost:9090/api/v1/rules → dind-disk-cap / RpiDindDataRootFillingUp health=ok, state=inactive
$ <rule expression> → nodename=rpi value=0.5799 (57.99 % used, threshold 0.70)
```
Flux applied the change at `master@sha1:0a97d9305fd8adf07efa567b994c0754756142f3`;
`kubectl -n flux-system get kustomizations` → `apps`/`monitoring` `True` at that
revision.
Disk, before → after: `/dev/sda2 917G, 490G used / 390G avail (56 %)` →
`496G used / 384G avail (57 %)`, with both dind data-roots now on the same
filesystem (`du -sh`: 5.2 G shared + 1.3 G deploy after the first jobs; steady
state is expected to reach ~146 G shared once the 141 GB of target volumes have
regrown inside dind — they rebuild cold by design, §4.2).
### 16.4 What is still host-Docker dependent
- **Nothing on the job path.** `onionwire` ci/fuzz/release and `sirius-growth`
`deploy-site` all execute against the in-pod daemon (a job's `docker version`
reports 27.5.1, the host's is 29.7.2).
- The **nightly prune** still mounts the Pi socket on purpose for its
`host-daemon` container: it is the cleanup path for the four host containers
that remain (`registry`, `garage`, `handyman-site`, `sirius-growth-site`). A
maintenance pod, not a job daemon.
- `/opt/siriusdevops` on the Pi is **kept, unused, as the rollback source**
(`runner/config/runner.ini`, `runner-deploy/data/runner.ini`, `docker-static`,
`cli-plugins`, the compose file). Nothing in the new Deployments reads it.
- The old host-daemon CI volumes (`onionwire-target-ci` 95.8 GB, `-sdk` 17.7 GB,
`-fuzz` 24.0 GB, `-aarch64` 3.2 GB) are **abandoned, not deleted** — that is the
rollback's warm cache, and it still occupies 141 GB on the Pi.
- Same host dependency as before, unchanged by design (§14): QEMU/binfmt is
kernel-global on the Pi, so the `--platform linux/amd64` cross build works
inside dind without an in-pod registration.
### 16.5 Rollback (executed once, then re-applied)
```
# 1. stop the dind pods (a job container lives inside them, so it dies with them)
kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=0
kubectl -n forgejo scale deploy/forgejo-runner-deploy-arm64 --replicas=0
# 2. Flux owns these files: suspend the apps Kustomization, or the next
# reconcile puts the dind manifests straight back
flux -n flux-system suspend kustomization apps
# 3. restore the previous revision of the three files
git -C ~/Projects/homek8s show <prev-sha>:apps/base/forgejo/runner-arm64.yaml | kubectl apply -f -
git -C ~/Projects/homek8s show <prev-sha>:apps/base/forgejo/runner-deploy-arm64.yaml | kubectl apply -f -
git -C ~/Projects/homek8s show <prev-sha>:apps/base/forgejo/runner-configmap.yaml | kubectl apply -f -
# 4. resume + reconcile to come back to the dind manifests
flux -n flux-system resume kustomization apps
```
**What the drill actually showed** (and what to do differently):
- `kubectl apply -f <old manifest>` does **not** remove the `dind` container — the
strategic merge keeps list items missing from the applied config. The rollback
came up with `containers: [dind, runner]` and the expected host socket
(`/var/run/docker.sock` as `srw-rw---- root 984`, `docker version` inside the
runner container reporting the **host** daemon 29.7.2, not 27.5.1), i.e. it
*worked* — but with a dead sidecar still in the pod. Use
`kubectl replace --force -f <old manifest>` (or a real `git revert` + Flux
reconcile, which prunes correctly) if you want the pod spec literally back.
- Restoring the dind Deployments, the first pod start failed once with
`failed to start containerd: timeout waiting for containerd to start` (dockerd
exit 1) after the previous pod had been force-deleted, then succeeded on the
kubelet retry. If it ever loops, scale to 0 and clear
`<pv>/docker/containerd/daemon` while the pod is down — never while it runs
(the DiskPressure runbook rule).
- Identity survived the round trip unchanged: after restore the runner again
logs `runner: pi-runner, with labels: [docker-arm64 arm64 docker], declared
successfully` and `action_runner.last_online` is current for ids 6, 8 and 14.
Verify after a rollback: pod `1/1 Running` on rpi, `action_runner.last_online`
moving for ids 6 and 14, and `ssh rpi docker ps` showing `GITEA-ACTIONS-*`
containers during the next job. The identity files exist in **two** places after
the cutover (Pi host + PV), which is exactly why the rollback needs no
re-registration in either direction. The PVs are `Retain`, so nothing is lost by
leaving them.