# Homelab Deployment Guide ## Select and verify a profile Jeannie runs from the Debian operations laptop. Choose one of the three [cluster profiles](architecture.md#profile-isolation-and-switching) explicitly; the committed inventory default remains `pimox`. | Profile | Runtime | Kubeconfig | | --- | --- | --- | | `debian` | Laptop kubeadm CP and two Pimox workers | `~/.kube/config` | | `pimox` | Pimox CP VM and two worker VMs | `~/.kube/pimox-config` | | `k3s` | Native Orange Pi host | `~/.kube/opi5-k3s-config` | For the already enrolled native cluster: ```bash export LAB_CLUSTER_PROFILE=k3s export LAB_CLUSTER_RUNTIME=k3s export TF_VAR_cluster_runtime=k3s export KUBECONFIG="$HOME/.kube/opi5-k3s-config" ./jeannie cluster-profile ./jeannie cluster-context check ./jeannie cluster-runtime check ``` When changing profiles, clear stale runtime, kubeconfig, host and `TF_VAR_*` overrides first. The runtime guard rejects conflicting runtime overrides rather than assuming that an old shell environment describes the new profile. Before an apply, import, cleanup or healing action, Jeannie checks the selected API endpoint, CA fingerprint and `kube-system` UID against its enrolled identity. Review `cluster-context enroll`, verify the identity independently on the target host, then use `enroll --yes` for a new cluster. Do not reuse another cluster's identity or copy its scoped state into a fresh profile. The [identity guide](cluster-context.md) explains reviewed legacy state migration. Deployment/start pipelines also check conflicting services, K3s workload processes and VM state, and hold a cross-profile runtime lock. Native K3s requires every Pimox VM stopped. The kubeadm modes require native host K3s stopped, plus the other profile's control plane stopped. Runtime probe failures block deployment. Stop the selected old mode with `stop-cluster` before switching. ## Move laptop K3s to the Orange Pi The accidental K3s deployment on `.73` is retired through a resumable transition to the declared native host `.80`. Run this on the Debian laptop: ```bash cd ~/my-homelab-configs git pull --ff-only gitea main ./jeannie cluster-transition k3s-to-native ./jeannie cluster-transition k3s-to-native --yes ``` The first invocation prints the plan; `--yes` stops and disables laptop K3s, stops only its private workload process trees, backs up its server datastore and configuration, archives its scoped identity/state, and gracefully stops Pimox VMs. It prepares a checksum-verified registry copy on the Orange Pi before native K3s starts. Existing different remote data is preserved and blocks copying. The worker used as a registry source can be started temporarily, then stopped. The command bootstraps the native cluster, compares its API identity with direct SSH reads from the Orange Pi, enrolls that identity, then runs `platform all` and `apps` in sequence. It stops on failure. Repeat the same command to resume; do not delete the private transition journal or scoped state to force a retry. It is also API-allowlisted after rebuilding the API binary. Old state is retained under `~/.local/share/homelab/retired-clusters/` and the stopped datastore archive under `/var/backups/jeannie-k3s-laptop-*`. The journal is `~/.local/share/homelab/transitions/k3s-to-native.json`. Other laptop PVC data stays on the laptop: this copies registry data, not all application databases. See [registry transition details](../bootstrap/apps/README.md). The native `opi5plus` node has reported Ready. Platform and apps completion remain separate checks. Do not run another deployment alongside the transition. ## Scheduling and deployment gates Before platform/apps apply, `scripts/scheduling-preflight.py` renders planned Helm and Argo sources and compares requests with allocatable resources and live reservations. It checks selectors, taints, affinity, host ports, PV placement and rollout budgets. Low current CPU usage does not free CPU reservations. One-core nodes can run workloads when the reservations and placement fit. Fresh operator workloads can use an explicit estimate of primary resources; generated sidecars and volumes still require post-apply readiness checks. Missing CNI is treated as initial bootstrap only when the Calico creation plan and live node state establish that case. Existing CNI failures remain blockers. Single-node platform labels target the selected node across runtimes. Follow the [code map](code-map.md) for the actual guard, backend and storage entrypoints. Recognized transient transport failures have bounded retries; identity, ownership, configuration and scheduling errors require correction. Init diagnostics are private under the selected profile's `diagnostics/`. Do not fix a scoped backend failure by forcing a legacy state copy. ## Prerequisites On the Debian host: - OpenTofu - Docker with Buildx - kubectl and Python with PyYAML for profile, identity and scheduling helpers - kubeadm, kubelet and containerd for kubeadm profiles; native K3s is installed remotely by the cluster layer and uses its own runtime - SSH access to worker nodes - SSH access to the OCI edge host - Go toolchain for Jeannie core helpers; `./jeannie up` installs `golang-go` on the Debian host if it is missing - enough persistent storage for `/data/openebs/local` and Docker's data root After a clean Debian reinstall, bootstrap the host package set and desktop configuration first: ```bash sudo apt-get update sudo apt-get install -y git ansible sudo git clone /home/jv/my-homelab-configs cd /home/jv/my-homelab-configs ansible-playbook -K -i bootstrap/host/inventory.ini bootstrap/host/playbook.yml ``` If you kept the private app-config archive generated from the old Debian host, pass its generated `ansible-vars.yml` with `-e @/path/to/ansible-vars.yml`. Details are in `bootstrap/host/README.md`. The selected profile declares its kubeconfig path. Keep `KUBECONFIG`, `KUBECONFIG_PATH`, `LAB_KUBECONFIG_PATH` and `TF_VAR_kubeconfig_path` aligned if you set overrides; an override does not replace the pinned identity checks. ## Implementation Language Policy Jeannie keeps `./jeannie` as the stable command entrypoint. New durable read-only orchestration, report rendering, inventory parsing, status/doctor logic, and self-heal planning should prefer Go under `cmd/jeannie-core` because it ships as one small binary and is easier to test than Bash. Bash remains for thin compatibility wrappers and remote shell glue. Python remains acceptable for AI/RAG, data-heavy utilities, or cases where an existing Python ecosystem is the clear fit. New repo features should choose the smallest language that fits the task instead of defaulting to Bash. ## Version Discipline Each cluster should use compatible API server and kubelet versions. The kubeadm profiles use the `v1.36` image line; native K3s currently pins `v1.31.5+k3s1`. These are independent clusters, not mixed-version nodes in one cluster. Changing profiles must not join old workers to the new native runtime. Check node versions from the Debian host: ```bash ./jeannie doctor-versions ``` The check prints the API server, kubelet versions, kubelet minors, and containerd runtimes. It exits nonzero when kubelet minors differ from the API server minor or when containerd major versions are mixed. The Gitea Actions auto path runs this check before app deploys. Do not treat version drift as authorization to destroy an enrolled cluster: automatic rebuild is refused because it changes the pinned identity. Review any image, worker and re-enrollment transition first. ## Deploying From the Debian server: ```bash cd ~/my-homelab-configs ./jeannie up ``` The script first deploys external Gitea to the Debian host with Docker Compose under `/data/homelab-gitea`, backed by the HP laptop NVMe, so Git stays outside the Kubernetes rebuild blast radius. It then detects the Pimox host at `192.168.100.80` in kubeadm mode. When SSH, `qm`, and `vmbr0` are available, it applies `bootstrap/provisioning`, creates or reuses the Debian 13 arm64 template, creates or reuses one worker VM clone, discovers the guest IP through qemu-guest-agent, and passes that worker into the cluster layer. It then applies the remaining OpenTofu stacks, refreshes Argo CD apps, waits for the local registry, builds the website and demos images when their source changed, pushes them to the registry, recreates pods only after a new image is built, and applies the edge stack. For native K3s, worker/template provisioning and OpenWrt VM startup are skipped. The selected native cluster is bootstrapped over SSH and uses the same platform and application layers with live single-node scheduling checks. Run `up` only after enrollment and after any existing transition has completed. Set `LAB_PIMOX_PIPELINE=false` to skip Pimox automation. Set `LAB_PIMOX_WORKER_COUNT=0` to create or refresh only the template. The pipeline keeps the template on its configured `local` storage, creates new worker VM clones on `opi5_ssd` by default when that Pimox storage is available, checks that the Pimox bridge already exists, refuses `local` as worker clone storage, grows existing Pimox guest root filesystems to the configured profile size, and refuses to edit Orange Pi host networking. Keep durable data on the HP Debian laptop's `data-vg` or external backups; treat Orange Pi VM disks as rebuildable worker capacity. `LAB_PIMOX_SKIP_WORKER_INDEXES` defaults to an empty value, so the pipeline owns worker index `1` and VMID `9010` when `LAB_PIMOX_WORKER_COUNT=1`. Set `LAB_PIMOX_SKIP_WORKER_INDEXES=1` if an existing manually created first worker must be left untouched, or set `LAB_PIMOX_WORKER_COUNT=2` to manage both VMID `9010` and VMID `9011`. Pimox workers can join the tailnet during cluster worker bootstrap. Keep the ephemeral or pre-authorized auth key outside Git, either in `~/.config/homelab/tailscale-pimox-worker.authkey` on the Debian host or in `LAB_PIMOX_WORKER_TAILSCALE_AUTH_KEY`. Then run the cluster pipeline with: ```bash LAB_PIMOX_WORKER_TAILSCALE_ENABLED=true ./jeannie up ``` For existing workers, prefer the Jeannie wrapper because it reads the generated worker keys and exports the correct OpenTofu variables: ```bash ./jeannie workers tailnet ``` When applying `bootstrap/cluster` directly, use the OpenTofu variable name instead of the Jeannie `LAB_` wrapper: ```bash TF_VAR_worker_tailscale_enabled=true \ tofu -chdir=bootstrap/cluster apply \ -var-file="$PWD/.lab/cluster-workers.auto.tfvars.json" ``` Worker Tailscale defaults to `--accept-routes=false` because these VMs already live on the homelab LAN; accepting an advertised `192.168.100.0/24` route can steal their local LAN route and break SSH or MetalLB traffic. Pod egress SNAT from the Kubernetes pod CIDR to `tailscale0` stays enabled, so pods on Pimox workers can reach tailnet-only services. Set `LAB_PIMOX_WORKER_TAILSCALE_ACCEPT_ROUTES=true` only when the worker must consume tailnet-advertised routes that do not overlap the local LAN. Set `LAB_PIMOX_WORKER_TAILSCALE_POD_EGRESS_SNAT=false` when pod egress through `tailscale0` is not wanted. `./jeannie doctor-cluster` checks Pimox worker tailnet egress against `${LAB_PIMOX_WORKER_TAILNET_PROBE_HOST:-LAB_DEBIAN_TAILSCALE_IP}` and `${LAB_PIMOX_WORKER_TAILNET_PROBE_PORT:-LAB_GITEA_HTTP_PORT}`. OpenWrt firewall VM automation is available as a standalone command because it attaches to both WAN and LAN bridges. Run `./jeannie openwrt` after `vmbr1` already exists on the Orange Pi. The pipeline downloads the OpenWrt ARM SystemReady EFI image, writes basic WAN/LAN/firewall config into the image, imports it as VM `9100`, attaches `vmbr0` as WAN and `vmbr1` as LAN, and stores the VM disk on the selected non-local Pimox storage. It leaves the VM stopped and not enabled for host boot by default. It does not use the Debian Kubernetes golden-node template for OpenWrt. The website and demos images default to `linux/amd64,linux/arm64` because both deployments can schedule on either the Debian host or ARM workers. Override with `WEBSITE_IMAGE_PLATFORMS` or `DEMOS_IMAGE_PLATFORMS` only when intentionally restricting node placement. Build metadata is written under `.lab/` so repeat runs can skip the website or demos image build when the source hash, platform, image reference, and registry manifest still match. The website build is intentionally performed on the Debian homelab path and the Gitea Actions runner, not on a laptop. The current image uses `php:8.5.12-fpm-alpine`, installs Apache, routes PHP through PHP-FPM, enables OPcache for immutable image deploys, and runs `apps/website/render-static-pages.sh` during the image build. That render step produces static HTML for `/`, `/cv.php`, `/blog.php`, `/demos.php`, and `/homelab-tree.php` in the static languages. Runtime PHP remains for write and translation endpoints such as `save_idea.php`, `visitor_ideas.php`, `translate.php`, and `save_lang.php`. Set `LAB_GITEA_DEPLOY=false` to skip the external Gitea deployment step when the service is already managed manually. The default Gitea target is `jv@192.168.100.73`, install directory `/data/homelab-gitea`, HTTP port `3000`, and SSH port `32222`. Before continuing into Pimox, cluster, apps, or edge changes, `./jeannie up` runs `./jeannie preflight`. The preflight verifies Gitea, Debian Docker root, Debian Tailscale IP, RPi Docker root fallback state, RPi Tailscale IP, Pimox worker storage, and OCI edge SSH. Run it directly when changing inventory or host storage/networking: ```bash ./jeannie preflight ``` If the Debian Docker root check fails after a reinstall, repair it before running the full pipeline: ```bash ./jeannie fix-debian-docker-root ``` When `./jeannie up` sees an existing tracked kubeadm control plane but the Kubernetes API is down, it starts the saved runtime before applying cluster changes. Use `./jeannie rebuild-cluster` only when you intentionally want to destroy and recreate the cluster. ## Validation Useful checks after a rebuild: ```bash export KUBECONFIG=/home/jv/.kube/config kubectl get nodes kubectl top nodes kubectl -n argocd get applications kubectl -n container-registry get pods kubectl -n website-production get pods -o wide kubectl -n demos-static get pods -o wide ssh jv@192.168.100.73 'cd /data/homelab-gitea && sudo docker compose ps' ssh jv@192.168.100.73 'cd /data/homelab-heimdall && sudo docker compose ps' docker info --format '{{.DockerRootDir}}' df -h / /data /data/openebs/local /data/docker ``` The website should be reached through the configured public hostname, not the raw OCI IP address, because the Let's Encrypt certificate is issued for the hostname. Run a read-only health snapshot from the Debian server with: ```bash ./jeannie help ./jeannie status ./jeannie capacity ./jeannie capacity-advisor ./jeannie capacity-limits ./jeannie recover-plan ./jeannie recover-power --dry-run ./jeannie impact --since HEAD~1 ./jeannie review-last-change ./jeannie scorecard ./jeannie explain scorecard ./jeannie gitops-status ./jeannie cert-check ./jeannie grafana-dashboards list ./jeannie release-snapshot ./jeannie backup-status ./jeannie synthetic-checks ./jeannie resource-budget ./jeannie control-plane status ./jeannie artifact-cache status ./jeannie blockchain-devnet status ./jeannie blockchain-test ./jeannie blockchain-wallet instructions ./jeannie golden-ledger check ./jeannie route-inventory ./jeannie workers list ./jeannie change-journal list ./jeannie map ``` `help` prints the grouped command reference in pipeline order, from inventory and bootstrap through cluster lifecycle, reports, observability, recovery, access, apps, security, AI, and destructive commands. `status` uses the reusable report UI and defaults to showing only failures and warnings so the terminal stays readable. Use `./jeannie status --all` to show every check, `--details` for row details, `--json` for structured output, or `--verbose` for the older full host/Docker/Kubernetes/Pimox/RPi/ Tailscale/HTTP dump. The cascade includes "what broke" signals such as deployment readiness, pod restarts, node pressure, disk pressure, Traefik 5xx/404 log evidence, and recent Gitea errors. High-signal Prometheus alerts live in `apps/homelab-alerts`. They cover node readiness, pod restart storms, unavailable deployments, node/PVC storage pressure, Traefik 5xx spikes, website availability, and Gitea/Pi-hole scrape coverage. Keep this set small so alerts remain actionable. Application egress is controlled with Kubernetes NetworkPolicies where the lab owns the workload. The website namespace defaults to denied egress and allows only DNS, Redis, and the Debian Ollama endpoint. The security lab namespace is isolated from the cluster and LAN while allowing DNS plus outbound HTTP/HTTPS for controlled practice targets. `capacity` is the placement report for the hardware you already have. By default it uses the compact report renderer and shows summarized Debian, Kubernetes, Pimox, RPi, and placement signals without dumping full details. Use `./jeannie capacity --details`, `--json`, `--only problems`, or `--verbose` for the older full capacity dump. `capacity-advisor` interprets capacity, resource-budget, and control-plane placement signals to recommend whether to add Pimox VMs, taint Debian, or fix resource definitions first. `capacity-limits` prints suggested Kubernetes `resources.requests` and `resources.limits` YAML snippets for containers missing them. It uses `infra/resource-recommendations.yml` as a conservative starting profile and does not edit manifests. `recover-plan` prints the disaster recovery order and lightweight prerequisite checks, from Debian and Gitea through DNS, Pimox, Kubernetes, GitOps apps, and edge verification. `recover-power` runs the post-outage recovery sequence in dependency order: Debian runtime, Gitea, RPi DNS, Pimox workers, Kubernetes, GitOps/apps, and edge/public checks. Use `recover-power --dry-run` to preview the sequence. `impact` explains what a change may touch before you apply it. Use `./jeannie impact --since HEAD~1` for the last commit or pass paths like `bootstrap/edge` and `apps/website`. `review-last-change` summarizes the last commit, runs impact analysis for the touched files, and prints validation plus rollback hints. `scorecard` rolls up backup readiness, GitOps health, DNS/RPi health, cluster health, edge health, capacity pressure, security posture, public certificates, inventory, and docs freshness into a compact pass/warn/fail report. `explain` is the read-only follow-up for warnings, failures, and corrective output. It can run safe report commands itself, such as `./jeannie explain scorecard`, `status`, `capacity`, or `resource-budget`, and it can explain captured output with `./jeannie explain output < saved-output.txt`. It lists what each finding means, diagnostic commands, whether a Jeannie fix command already exists, and risk/auto-fix safety. Report-oriented commands share the reusable UI module in `scripts/report-ui` and renderer in `scripts/report-render`. Commands emit status TSV rows, and the renderer prints compact grouped summaries by default, with details or JSON available for future TUI/web output. Rows may include separate `fix`, `graph`, and `query` fields so a warning can point to both the next `jeannie` command and the matching Grafana panel or Explore query. `gitops-status` prints a focused Argo CD view: application sync and health, out-of-sync or degraded apps, repository secret presence, recent Argo CD events, and recent repo-server/application-controller errors. `grafana-dashboards` manages repo-provisioned Grafana dashboards under `bootstrap/platform/grafana-dashboards`. `./jeannie up` provisions them through the platform stack; `./jeannie grafana-dashboards apply` rebuilds just the dashboard ConfigMaps and restarts Grafana. The optional blockchain devnet dashboard uses metrics from `infra/blockchain-devnet/metrics/exporter.py`. `cert-check` verifies public DNS, TLS certificate expiry, public website/Gitea HTTP status, and DuckDNS-to-OCI edge IP drift from the canonical inventory. `release-snapshot` writes a timestamped pre-change report under the homelab state directory with Git state, Kubernetes/Argo CD/Helm state, workload images, public URL status, and pointers to the latest Gitea/OpenTofu backups. `backup-status` reports freshness for Gitea backups, OpenTofu state backups, restore drill reports, and repo-managed Pi-hole restore inputs. The main `status` cascade includes this as a warning signal. `synthetic-checks` runs end-to-end probes for Gitea HTTP/SSH, registry API, Pi-hole DNS, Traefik LAN HTTP, and temporary Kubernetes DNS/ingress pods. The registry push/pull smoke test is opt-in with `LAB_SYNTHETIC_REGISTRY_PUSH=true`. `resource-budget` checks the report-only policy in `infra/resource-budgets.yml` against Kubernetes pod requests/limits and Debian host disk/memory signals. Use it before adding heavier workloads so the HP laptop remains usable. By default it summarizes missing requests/limits by namespace; use `./jeannie resource-budget --details` for every pod/container. `control-plane` shows or manages the Debian Kubernetes control-plane scheduling taint. After Pimox workers are stable, use `./jeannie control-plane taint` to keep normal app/data-plane pods off the Debian host while control-plane and DaemonSet workloads continue using their normal tolerations. `artifact-cache` manages an optional Debian-host cache stack in `infra/artifact-cache` with apt-cacher-ng and a Docker Hub registry pull-through cache. Use `artifact-cache instructions` for client configuration snippets. `blockchain-devnet` manages an optional local Ethereum Anvil devnet under `infra/blockchain-devnet`. It is for contract, wallet, RPC, and observability learning only; never use real seed phrases or mainnet keys. `blockchain-test` runs the Foundry tests in `labs/blockchain`. The lab starts with a simple `Counter` contract and ownership tests so there is a known-good baseline before practicing vulnerable contracts. `blockchain-wallet` provides disposable dev-wallet generation, address derivation, and message-signing practice. It is documented in `labs/blockchain/WALLET_LAB.md`; never use real seed phrases or funded keys. `golden-ledger` shows or validates `infra/pimox/golden-image-ledger.yml`, the reviewable record of template VMID, storage, OS release, Kubernetes pins, runtime versions, and build metadata for Pimox worker golden images. `route-inventory` reports Kubernetes ingress hosts, paths, backend services, TLS coverage, and visible Uptime Kuma monitor coverage so stale routes and missing monitors are easier to spot. `workers` provides named Kubernetes/Pimox worker lifecycle operations: `list`, `tailnet`, `start`, `stop`, `drain`, `uncordon`, `recreate-plan`, and `rebalance`. Use `recreate-plan ` before replacing one broken Pimox worker so the cluster drain, VM stop, and `./jeannie up` path stay ordered. `change-journal` lists local journal entries written before risky commands such as `up`, `apps`, `deploy-gitea`, `rpi-services`, `stop-cluster`, `start-cluster`, `rebuild-cluster`, `release-snapshot`, and `nuke`. Entries live under `${HOMELAB_STATE_DIR}/change-journal` and record Git revision, branch, dirty file count, and command details. `map` prints a dependency map from the canonical inventory, covering public entry, GitOps automation, cluster foundation, DNS, observability, and security learning paths. `./jeannie map --dot` emits Graphviz DOT. Focused doctor commands run narrower read-only checks. They use the same problems-first UI as `status`; add `--all`, `--details`, `--json`, or `--verbose` when you need more context: ```bash ./jeannie doctor-edge ./jeannie doctor-gitea ./jeannie doctor-rpi ./jeannie doctor-cluster ``` `doctor-cluster` also checks whether Pimox workers have Tailscale installed, `tailscaled` active, a Tailscale IP, and TCP egress to the configured tailnet probe service. ## RPi Services The Raspberry Pi runs lightweight always-on services outside Kubernetes from `infra/rpi-services`: - Pi-hole on DNS port `53` and web port `8081` - Unbound as Pi-hole's first upstream resolver - Uptime Kuma on port `3001` Deploy or refresh them from the Debian server with: ```bash ./jeannie rpi-services ``` `./jeannie up` also runs this step unless `LAB_RPI_SERVICES_DEPLOY=false` is set. Docker data for the Raspberry Pi is expected under `/nvme-storage/docker` when that path is an active writable mount point. If the NVMe is missing or resets, it rewrites Docker's `data-root` to `/var/lib/docker` and restarts Docker so DNS can still come up from the SD/root filesystem. Pi-hole uses Unbound first and public fallback upstreams after that, so DNS can continue resolving if the Unbound container stops. Repo-managed Pi-hole state lives in `infra/rpi-services/adlists.txt`, `infra/rpi-services/local-dns-records.txt`, `infra/rpi-services/cname-records.txt`, and `infra/rpi-services/static-dhcp-hosts.txt`. The bootstrap inserts adlists without deleting manually added Pi-hole lists, then renders the DNS/CNAME/DHCP files into a managed dnsmasq config inside the Pi-hole container. If `PIHOLE_WEBPASSWORD` is not provided, the bootstrap generates one and keeps it in `/opt/homelab-rpi-services/.env`. Uptime Kuma monitor seeds live in `infra/rpi-services/uptime-kuma-monitors.json` and are applied after the first Kuma user exists. `./jeannie status` and `./jeannie doctor-rpi` test Pi-hole DNS, direct Unbound DNS, public fallback resolver readiness, Uptime Kuma HTTP, and whether Docker is currently using `/nvme-storage/docker` or has fallen back to `/var/lib/docker`. ## Adding Nodes For Pimox on Orange Pi 5 Plus, `./jeannie up` can create the Debian 13 arm64 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two 8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` entries so native `qm` CPU topology is the only `-smp` argument. Set `LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, `LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox disk, and grows the guest root filesystem during the pipeline. The NVMe that was previously attached to the Orange Pi now belongs to the HP Debian laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and override variables are in `bootstrap/provisioning/README.md`. Worker indexes are stable. Index `1` maps to VMID `9010`, node name `pimox-worker-01`, and worker key `pimox01`; index `2` maps to VMID `9011`, and so on. `LAB_PIMOX_SKIP_WORKER_INDEXES=1` leaves the first slot unmanaged while allowing higher indexes to be automated. Worker networking defaults to static because the ISP modem DHCP server does not answer Pimox worker VM DHCP requests behind `vmbr0`. Set `LAB_PIMOX_WORKER_NETWORK_MODE=dhcp` only when LAN DHCP is known to answer VM traffic. Static mode uses `LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`, `LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, and `LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`. For static workers, Jeannie also adds targeted Pimox-host forwarding exceptions for each worker IP in `DOCKER-USER` when that chain exists, or `FORWARD` otherwise. If `iptables` is missing on the Pimox host, Jeannie installs it before adding those rules. Disable this with `LAB_PIMOX_WORKER_CONFIGURE_FORWARDING=false` only when the Pimox host firewall already permits bridged worker IP traffic. Before adding rules, Jeannie saves `iptables-save` output on the Pimox host under `${LAB_PIMOX_WORKER_IPTABLES_BACKUP_DIR:-~/iptables-backups}`. Worker NIC MAC addresses default to the VMID-derived deterministic format used by the original working Pimox worker path. Set `LAB_PIMOX_WORKER_MAC_MODE=auto` only when you explicitly want Pimox to generate the MAC. Worker creation fails faster than template creation: static guest-network configuration waits up to `LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=300`, worker IP/SSH readiness waits up to `LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`, and SSH after an IP appears waits up to `LAB_PIMOX_GUEST_SSH_TIMEOUT_SECONDS=600`. Static guest-network validation skips the extra LAN ICMP probe by default because the ISP modem may not answer worker VM pings. Set `LAB_PIMOX_WORKER_REQUIRE_LAN_PROBE=true` only when the gateway/probe host should be required during qemu-guest-agent network setup. After qemu-guest-agent reports an IP, Debian skips the extra ICMP host probe by default and lets SSH be the reachability check. Set `LAB_PIMOX_WORKER_REQUIRE_HOST_PROBE=true` only when you want a faster ICMP gate. `LAB_PIMOX_GUEST_TIMEOUT_SECONDS` remains the broader template-build timeout. Before `./jeannie apps` changes any application resources, Jeannie requires generated kubeadm/Pimox workers to be `Ready` with positive CPU capacity. Native K3s ignores that old VM inventory and uses live scheduling preflight. `LAB_PIMOX_APP_DEPLOY_MIN_CPUS` no longer sets a two-core floor; the scheduling estimate determines whether each workload can fit. Long-running `./jeannie up` steps keep compact output by default, but the active step line refreshes with elapsed time and the latest log line. Set `JEANNIE_PROGRESS_INTERVAL_SECONDS=5` for faster heartbeats, or `JEANNIE_VERBOSE=true` to stream full command output. Independent host services run through the Go DAG runner during `up`: Gitea deploy/bootstrap, RPi services, Pimox workers, OpenWrt, and OCI edge host checks can progress concurrently. Set `JEANNIE_UP_PARALLELISM=1` to force sequential execution while troubleshooting, or raise it above the default `4` if the lab can absorb more concurrent work. VM profiles retain their template and worker lifecycle controls. Desired worker size is two CPUs with 8 GiB memory and a 30 GiB default root disk; observed capacity and reservations decide scheduling. CPU pinning uses a generated KVM hook rather than unsupported `qm --affinity`. Native K3s skips this VM path. The Raspberry Pi is excluded from worker generation unless explicitly enabled. Automatic `rebuild-cluster` is refused for an enrolled identity; review any destructive worker or control-plane replacement separately. To pause the Kubernetes cluster without deleting kubeadm files, OpenTofu state, PV data, or VM disks, run: ```bash ./jeannie stop-cluster ``` Behavior follows the selected profile: native K3s stops the Orange Pi service and only its private workload process trees; Pimox stops its CP and worker VMs; the hybrid Debian profile stops its local kubeadm runtime and worker VMs. Starting a stopped cluster verifies the enrolled endpoint and CA offline, starts the selected runtime, then verifies the live namespace UID before deployment. It refuses to start alongside another profile. This stops `kubelet`, stops Kubernetes CRI containers with `crictl` when available, stops any workers listed in `WORKER_SSH_TARGETS`, and gracefully shuts down automated Pimox worker VMs. It intentionally leaves the host `containerd`/Docker stack running so external Docker Compose services such as Gitea stay online. It does not run `kubeadm reset`, delete CNI files, or remove state. Use `LAB_CLUSTER_STOP_CONTAINERD=true` only when you intentionally want to stop the host container runtime too. Use `LAB_CLUSTER_STOP_VM_TIMEOUT_SECONDS` to change the Pimox shutdown timeout, `LAB_CLUSTER_STOP_FORCE=false` to avoid a hard `qm stop` after timeout, and the usual `LAB_PIMOX_WORKER_COUNT`, `LAB_PIMOX_WORKER_BASE_VMID`, and `LAB_PIMOX_SKIP_WORKER_INDEXES` variables to select VM workers. Resume the runtime with: ```bash ./jeannie start-cluster ``` Kubernetes worker generation defaults to automated Pimox workers only. The Raspberry Pi stays out of the cluster unless `LAB_INCLUDE_RASPBERRY_WORKER=true` is set. Stale manual workers in `.lab/manual-workers.tsv` are ignored unless `LAB_INCLUDE_MANUAL_WORKERS=true` is set. To manage workers manually instead, add entries to `bootstrap/cluster/variables.tf` or a `.tfvars` file: ```hcl worker_nodes = { raspberrypi = { host = "192.168.100.89" user = "jv" node_name = "raspberry" ssh_key_path = "/home/jv/.ssh/id_ed25519" } } ``` Stateful apps currently pin retained local PVs to the `debian` node. Move or duplicate those PV manifests when you want storage on another node. ## Adding Platform Tools Add Helm releases through `bootstrap/platform`'s `extra_helm_releases` map. ## Secrets Use SOPS with age for secrets that need to live in Git. The Debian host bootstrap installs `age` and `sops`; then run: ```bash ./jeannie secrets-init ./jeannie secrets-check ``` `secrets-init` creates `~/.config/sops/age/keys.txt` if needed and renders `.sops.yaml` from `.sops.yaml.example` with the host's public age recipient. Commit `.sops.yaml`, but keep the private age key outside the repo. Operational notes are in `docs/secrets.md`. ## Guarded Self-Healing Jeannie can turn status findings into an experimental self-heal plan: ```bash ./jeannie status --heal-plan ./jeannie status --heal ./jeannie heal apply --yes ``` Normal `status` remains read-only. The heal planner maps known findings to guarded actions, chooses one highest-impact auto-eligible finding, checks the proposed command against `infra/agent-sandbox/policy.tsv`, and runs only that one action. Re-run `./jeannie status` after every heal cycle so Jeannie can reassess before touching the next issue. If a specific Pimox worker is NotReady, heal targets that worker with `./jeannie workers restart N` instead of repeating a broad cluster start. After an action runs, Jeannie waits for the target condition to clear and reports `healed` or `still failing`. Failed heal actions are placed on a short cooldown so Jeannie does not loop on the same VM restart; the next plan escalates to diagnostics instead. Destructive actions remain blocked. ### Alertmanager-driven first self-heal loop The first headless self-heal path is intentionally narrow and targets node image filesystem pressure / `FreeDiskSpaceFailed` symptoms. Alertmanager can call the Debian-hosted `jeannie-eventd` webhook. For a disk-pressure alert, the webhook maps the alert to the reporting Pimox worker and applies worker-scoped image and old pod-log cleanup; other alerts still flow through the guarded status/heal planner. For the first phase, the automatic mutations are: - prune unused container images and delete pod/container logs older than three days on the alerting Pimox worker; - delete stale Kubernetes pod records where the reason is `Evicted`, `NodeLost`, `Unknown`, or `ContainerStatusUnknown`. It does not delete PVCs, delete namespaces, or mutate OpenTofu state. Disk cleanup is limited to CRI image pruning and old pod/container logs; it does not touch application data. Apply mode remains disabled unless `LAB_SELF_HEAL_APPLY=true`. Test the event pipeline without mutating anything: ```bash ./jeannie self-heal dry-run infra/jeannie-eventd/free-disk-space-failed.sample.json ``` Preview stale pod cleanup directly: ```bash ./jeannie heal cleanup-stale-pods ``` Apply the narrow cleanup when the dry-run targets are correct: ```bash ./jeannie heal cleanup-stale-pods --yes ``` Run the webhook locally in dry-run mode: ```bash ./jeannie self-heal serve ``` Install or refresh the Debian systemd webhook service through Jeannie: ```bash ./jeannie self-heal install-service ``` Enable apply mode only after the dry-run output and audit files look correct: ```bash LAB_SELF_HEAL_APPLY=true ./jeannie self-heal serve ``` The systemd example binds the webhook to the Debian LAN address path so the cluster can reach it. Keep it limited to the homelab network/firewall. Audit artifacts are written under: ```text ${HOMELAB_STATE_DIR:-~/.local/share/homelab}/self-heal-events/ ``` The webhook also exposes Prometheus metrics at `/metrics`. The platform Prometheus scrape config collects `192.168.100.73:18081`, and the repo-provisioned `Homelab Self-Heal` Grafana dashboard shows event totals, applied action totals, failed events, and alert counts. Rebuild dashboards after pulling this change: ```bash ./jeannie grafana-dashboards apply ``` ## Destructive Rebuilds Profile switching uses `stop-cluster` and the selected startup/bootstrap path; it does not require `nuke`. Destructive actions require separate review of identity, scoped state, retained storage and recovery. `rebuild-cluster` refuses automatic destruction of an enrolled cluster because a rebuild changes its identity. Preserve backups and plan re-enrollment before any such maintenance.