feat: add Pimox control-plane disk diagnostics
This commit is contained in:
parent
cb6f442d97
commit
8a186262b0
|
|
@ -27,6 +27,7 @@ Commands:
|
|||
recreate-plan [index|all] Print the safe recreate sequence for Pimox worker(s)
|
||||
rebalance Restart evicted/pending pods and show scheduling pressure
|
||||
disk-status [index|all] Read-only filesystem and container-runtime pressure report
|
||||
disk-status control-plane Read-only control-plane VM filesystem/runtime report
|
||||
disk-cleanup [index|all] [--yes]
|
||||
Prune unused images and old pod logs on selected worker(s)
|
||||
EOF
|
||||
|
|
@ -282,10 +283,37 @@ worker_entry() {
|
|||
printf '%s\t%s\t%s\t%s\n' "${host}" "${user}" "${key}" "${node}"
|
||||
}
|
||||
|
||||
control_plane_entry() {
|
||||
local host="${LAB_PIMOX_CONTROL_PLANE_IP:-${LAB_CLUSTER_CONTROL_PLANE_LAN_IP:-192.168.100.65}}"
|
||||
local user="${LAB_PIMOX_CONTROL_PLANE_USER:-${LAB_CLUSTER_CONTROL_PLANE_USER:-jv}}"
|
||||
local key="${LAB_PIMOX_CONTROL_PLANE_SSH_KEY_PATH:-${LAB_CLUSTER_CONTROL_PLANE_SSH_KEY_PATH:-${HOME}/.ssh/id_ed25519}}"
|
||||
printf '%s\t%s\t%s\t%s\n' "${host}" "${user}" "${key}" "${LAB_CLUSTER_CONTROL_PLANE_NODE_NAME:-pimox-cp-01}"
|
||||
}
|
||||
|
||||
disk_status() {
|
||||
local target="${1:-all}"
|
||||
local index host user key node
|
||||
|
||||
if [[ "${target}" == "control-plane" || "${target}" == "cp" ]]; then
|
||||
IFS=$'\t' read -r host user key node < <(control_plane_entry)
|
||||
echo "===== control plane (${node}, ${host}) ====="
|
||||
ssh -i "${key}" -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${user}@${host}" 'bash -s' <<'REMOTE'
|
||||
set +e
|
||||
echo "-- filesystem"
|
||||
df -hP / /var/lib/containerd /var/lib/kubelet /var/log 2>/dev/null || true
|
||||
echo "-- container runtime image filesystem"
|
||||
sudo crictl imagefsinfo 2>/dev/null || true
|
||||
echo "-- runtime services"
|
||||
systemctl is-active containerd 2>/dev/null || true
|
||||
systemctl is-active kubelet 2>/dev/null || true
|
||||
echo "-- largest relevant paths"
|
||||
sudo du -xhd1 /var/lib/containerd /var/lib/kubelet /var/log/pods /var/log/containers 2>/dev/null | sort -h | tail -n 20 || true
|
||||
echo "-- recent control-plane errors"
|
||||
sudo journalctl -u kubelet -u containerd --since '2 hours ago' --no-pager 2>/dev/null | grep -Ei 'timeout|no space|diskpressure|evict|apiserver|etcd|failed' | tail -n 40 || true
|
||||
REMOTE
|
||||
return 0
|
||||
fi
|
||||
|
||||
for index in $(target_indexes "${target}"); do
|
||||
IFS=$'\t' read -r host user key node < <(worker_entry "${index}")
|
||||
echo "===== worker ${index} (${node}, ${host}) ====="
|
||||
|
|
|
|||
Loading…
Reference in New Issue