62 lines
3.1 KiB
Markdown
62 lines
3.1 KiB
Markdown
# Jeannie self-heal webhook
|
|
|
|
Install or reconcile the webhook from the checkout used for operations:
|
|
|
|
```bash
|
|
./jeannie cluster-profile select k3s
|
|
./jeannie platform monitoring
|
|
./jeannie self-heal install-service --apply
|
|
```
|
|
|
|
Use `debian`, `pimox`, or `k3s` as declared in inventory. Selection verifies the
|
|
enrolled endpoint and CA and persists the operational profile; it does not start
|
|
or stop a cluster. The service resolves that selection for each incoming event,
|
|
then pins it for the complete operation. Stale profile/kubeconfig environment
|
|
variables in existing systemd overrides do not choose the target. The installer
|
|
restarts the webhook to load new source. Without `--apply`, installation defaults to
|
|
dry-run mode unless `LAB_SELF_HEAL_APPLY=true` is explicitly supplied.
|
|
The rendered file is staged with its `.service` filename and checked using
|
|
`systemd-analyze verify --man=no` on Debian before replacing the installed unit.
|
|
An invalid rendered unit therefore leaves the existing unit file untouched.
|
|
|
|
`HomelabStaleResidualPods`, `KubePodEvicted`, and
|
|
`KubePodContainerStatusUnknown` select the guarded stale-pod cleanup directly.
|
|
They do not invoke the broad doctor planner or choose unrelated VM restarts.
|
|
The cleanup only selects supported residual states on controller-owned pods;
|
|
Completed/Succeeded and ordinary Pending pods are not cleanup targets. It does
|
|
not delete PVCs or change worker CPU configuration. Native K3s disk alerts use
|
|
the declared host and bundled `k3s crictl`, never worker VM operations. Cleanup
|
|
requires a live pinned identity, the data mount, and reachable registry, then
|
|
prunes unused images and vacuums host journals. Debian laptop automatic disk
|
|
cleanup remains disabled. A native single-node cluster cannot be drained through
|
|
the worker maintenance command.
|
|
|
|
Automatic actions require every alert to carry matching `cluster_profile` and
|
|
`cluster_uid` labels. Deploy `platform monitoring` to publish these external
|
|
labels before enabling automatic healing. Retired-cluster alerts are skipped.
|
|
Node/API alerts can use the guarded runtime startup action; an offline startup
|
|
check validates the enrolled endpoint and CA, followed by a live UID check after
|
|
startup. Mutations such as pod cleanup always require the live UID.
|
|
|
|
Doctor stdout and stderr are stored separately under
|
|
`~/.local/share/homelab/clusters/<profile>/self-heal-events/<event>/`. The `.log` file contains
|
|
stdout (JSON for the doctor), `.stderr.log` contains diagnostics, and
|
|
`result.json` records the chosen command and outcome. Generic cleanup
|
|
verification checks eligible residual records rather than requiring all
|
|
unrelated Pending workloads to become healthy.
|
|
|
|
Read-only validation:
|
|
|
|
```bash
|
|
systemctl is-active jeannie-eventd
|
|
systemctl show jeannie-eventd -p Environment --value
|
|
./jeannie heal cleanup-stale-pods
|
|
./jeannie workers disk-status control-plane # native K3s
|
|
```
|
|
|
|
Alertmanager repeats matching firing alerts according to its configured route
|
|
(currently one hour for this receiver); service installation does not itself
|
|
trigger a cleanup. Existing failed/completed pod objects do not prove that
|
|
their replacement workloads are unhealthy; Pending workloads need separate
|
|
scheduling diagnosis.
|