my-homelab-configs/docs/doctor-overview.md

85 lines
4.8 KiB
Markdown

# Focused Jeannie doctor
Use the same inventory areas as `status`, selecting one at a time:
```sh
./jeannie doctor oci
./jeannie doctor rpi
./jeannie doctor opi5
./jeannie doctor debian
./jeannie doctor cluster
```
The doctor reuses the selected area's status checks and adds focused
diagnostics for the OCI edge, RPi, Debian, and cluster. It does not offer an
all-area mode. Each device view checks OS kernel, uptime/load, available memory,
root filesystem usage and systemd state as well as its services. Orange Pi
also reports its selected K3s checks. Remote OS checks use inventory SSH access.
Existing `doctor-edge`, `doctor-gitea`, `doctor-rpi`, `doctor-cluster`, and
`doctor-k8s` remain available for their specialized investigations.
To investigate one item, copy its full check name from status, or provide an
Argo CD application name or Compose project/service:
```sh
./jeannie doctor cluster gitea-runner --details
./jeannie doctor gitea-runner
./jeannie doctor homelab-gitea/gitea
./jeannie doctor debian --item homelab-gitea/gitea --details
./jeannie remote doctor rpi --item homelab-rpi-services/pihole --ai
```
Matching is exact and case-insensitive. A short Compose service name is
accepted only when unambiguous. Jeannie collects the area's snapshots before
selecting the item; it reports an error if the name cannot be resolved. For a
selected Compose container it reads state, restart count, exit code and health;
for an Argo CD application it reads health, operation and unhealthy resource
status and deployment replica counts. An item without a scope is looked up in
Argo CD and the inventoried Compose hosts. If any source is unavailable, or a
name is ambiguous, specify its scope explicitly. It does not fetch container environment variables or Kubernetes
Secret contents. Remote Compose checks require noninteractive SSH and sudo.
Use `--ai` to request an evidence-validated Holmes explanation, or
`--no-local-rca` to disable it. AI is enabled by default for a selected item,
and is off by default for a whole host or cluster scope. It does not perform
repairs. `--json` returns structured evidence without AI output. These are
read-only checks; any suggested remediation should be reviewed separately.
For a selected Kubernetes application, Doctor also reads up to five pods selected
by each deployment's simple match-label selector and the latest pod events.
It extracts status, wait reasons, and bounded event messages without dumping
pod specs. Unsupported selectors or failed reads are reported as unknown.
When AI is enabled, focused Doctor invokes Holmes with the selected profile
and this evidence, forbids Bash execution with `--bash-always-deny`, instructs
Holmes not to call tools, and validates the citations and read-only command
against the collected report. Failed or rejected Holmes answers leave the
deterministic evidence available. Private evidence and logs are stored under the
Doctor K8s artifact directory. Other Holmes toolsets and credentials must still
be restricted independently; event messages may contain sensitive details and
the configured OmniRoute model can be external. The dedicated Gitea runner
text report remains deterministic and does not invoke Holmes.
For native K3s on the Orange Pi, `doctor opi5` collects the K3s service state,
data and runtime mount identities, USB ext4 candidates and recent storage
errors. If it detects a stale read-only mount whose device disappeared, it
offers `./jeannie doctor opi5 --repair-k3s`. That explicit local CLI action
checks the selected profile, pinned cluster identity, exclusive runtime and
operation locks, and requires failed or inactive K3s and one unmounted USB
ext4 partition. Before stopping private K3s workloads, it mounts the candidate
read-only with journal replay disabled and checks its K3s CA against the pinned
identity. It then unmounts the stale mounts without force, remounts the SSD,
verifies the CA and bind mount, starts K3s, and checks the live cluster identity.
It does not format a disk, run filesystem repair, or recreate the cluster.
If any mount is busy or a check fails, recovery stops; the report identifies the
last failure and further investigation is needed. A healthy K3s API does not
prove application health. The local runtime repair is refused through the API.
The Gitea runner has a specific diagnosis: it compares the live Argo CD
revision and Deployment with the committed zero-replica configuration, then
checks the Debian runner service. If the installed host service is inactive,
the report proposes a specific start command and asks before executing it in
an interactive terminal. A noninteractive or remote invocation never applies
that mitigation; it prints the command for a human to review. A running
systemd service alone does not prove runner registration or job execution.
The deterministic runner report does not request an AI explanation.