my-homelab-configs/infra/ai-stack/holmes-skills/k3s-stale-volume/SKILL.md

4.0 KiB

name description
k3s-stale-volume Diagnose Kubernetes pod I/O failures caused by a stale local-volume bind mount after the Orange Pi K3s storage device reconnects.

K3s stale local-volume mount

Use this procedure when a pod reports filesystem I/O errors and its local PV is backed by the Orange Pi /data mount. Other storage systems and failures need their own investigation. Facts from commands are evidence; errors and missing data mean unknown, not success.

Diagnose

  1. Check the selected cluster identity, namespace, pod UID and controller owner. Confirm the pod's container state and its previous logs; identify the affected mount path and the pod's PVC, bound PV, node and PV host path. Do not read or print Secret contents, application configuration or encryption keys.
  2. On the identified node, compare findmnt output for /data with the kubelet local-volume mount for the exact pod UID. Record each mount's source, major:minor and options. Verify the PV path is on the current /data mount, the current volume is the intended volume, and it is accessible read-write. Check the kernel journal for storage errors and device reconnection evidence. K3s embeds kubelet: use sudo -n journalctl -u k3s --no-pager -n 40, not journalctl -u kubelet. Kernel evidence is available through sudo -n journalctl -k --no-pager -n 40. Run the whole command inside the quoted SSH command. If access fails, report that gap; do not alternate equivalent failed journal queries. Historical logs are supplemental to the current mount comparison, not a reason to repeat the investigation.
  3. A stale mount is plausible if the pod mount remains read-only on a different, no-longer-present device while /data is read-write on the intended reconnected volume. Confirm the exact pod and controller before acting. An I/O error alone does not prove a permissions problem or this stale-mount case. Stop if identity, ownership, volume mapping, or storage health is uncertain. Distinguish an unknown hardware failure cause from verified current mount state: a normal controller-managed pod recreation does not require proving why a past USB disconnect occurred. Check current backing-path accessibility without printing application configuration or encryption keys.

Mitigate and validate

For a confirmed stale pod bind mount and a healthy controller, a normal deletion of that one pod can cause the controller to create a replacement with fresh mounts. Immediately re-check the pod UID and owner before deleting it. Once those checks support this mitigation, perform it rather than repeatedly reading the same pod/PVC/PV or unavailable journal. A controller is present when the verified owner exists and desires a replacement pod; zero ready replicas caused by this crashing pod do not by themselves mean it cannot recreate the pod. Use kubectl -n <namespace> delete pod <pod-name>; never use force or zero grace period. Do not delete, recreate, reformat or modify the PVC, PV, data, configuration or encryption keys. Do not regenerate an application key. When calling the Bash tool, include both required fields: command is the exact command and suggested_prefixes is an array containing kubectl. For example, the arguments are {"command":"kubectl -n demo delete pod example-123", "suggested_prefixes":["kubectl"]}. Substitute only the verified namespace and current pod name; this example is not an instruction to act on demo. If the pod is not controller-managed, mounts remain busy, the volume is not confirmed, or the delete fails, stop and report what remains unknown.

Verify a new pod UID is created, its local-volume mount points at the current read-write device, the container is ready without recurring I/O errors, and the application health has recovered. Compare with the pre-change evidence. Argo CD health alone is insufficient to prove data integrity or end-to-end function. Report the evidence, causal chain and missing links, command and output for the mitigation, and validation. Do not invent five whys when evidence is missing.