Repository navigation
Description
Problem Statement
A review of live cluster logs surfaced failures that are individually obvious and collectively invisible, because nothing correlates them. A node left NotReady,SchedulingDisabled had metrics-server retrying it every 12 seconds: six restarts and a log filled entirely with one unreachable host. Meanwhile a PersistentVolume delete had been timing out for three days behind a helper pod stuck Terminating. Each is a one-line symptom; none is reported anywhere an operator looks.
What exists at release/v0.2.25 (9c879ae) reads the signals but correlates none of them:
devops k8s status(src/devops_cli/commands/k8s/cluster_context.py:117-135) prints a node table after a bareload_kube_config(), so it follows kubectl's current context rather than the configured one.devops k8s pods(src/devops_cli/commands/k8s/diagnostics.py:36-56,84-125) prints the STATUS, READY and RESTARTS columns kubectl prints, computed byPodInfo.from_pod(src/devops_cli/models/k8s.py:334-369), which already derivesCrashLoopBackOff,Terminating,Init:…, per-containerlast_termination_reasonand anunhealthyflag.node_is_ready(models/k8s.py:97) reads a node'sReadycondition.- The TUI reads nodes and every pod in one refresh with a client-side timeout (
fetch_k8s_status,src/devops_cli/ui/data_providers.py:229-253) and a pod's events only when its inspector opens (fetch_pod_events,:261-275, matched by uid withCONST_K8S_POD_EVENT_FIELD_SELECTOR,src/devops_cli/config/constants.py:2304). Thatlist_namespaced_eventcall is the only event read in the code base; nothing lists cluster-wide events.PodEventInfo(models/k8s.py:370) keeps type, reason, message, count and last-seen, not the involved object. _get_unready_nodes(src/devops_cli/commands/k8s/cluster_runtime.py:172-198) shells out tokubectl get nodes -o json; its one caller isdeploy-stack(stack_lifecycle.py:781), which uses it to skip Helm--waiton DaemonSet releases.KubernetesService(src/devops_cli/k8s/service.py:227-302) lists nodes (cached) and pods and reads logs (tail bounded 1..10000), but none of those calls carries_request_timeout, and it has no event method.- The only "diagnosis" is the MCP prompt template
k8s_diagnostics_prompt(src/devops_cli/ai/mcp/server.py:2837,2857;src/devops_cli/ai/tasks/k8s_diagnostics_prompt.md), three lines of instructions to a model.
No code path reads cluster-wide Warning events, no code path joins a pod's symptoms to the node it runs on, and nothing names a cause or a remediation. No doctor command exists (grep -rn doctor src/ is empty); the only references are docs/ROADMAP.md:1138, a note in the #646 task file, and this item's task file, which still says v0.2.24 and Backlog. No commit has delivered any part of this item.
Proposed Solution
Add devops k8s doctor: one read-only command that gathers nodes, pods, cluster-wide Warning events and, for the pods already flagged, a bounded tail of container logs, through the Kubernetes API only; evaluates a fixed, ordered rule table over them; and prints a ranked list of findings, each naming the resource, the likely cause, the evidence and the remediation. The rules attribute symptoms to their cause so a cluster fault absorbs the workload symptoms it explains: pods crash-looping on a NotReady or cordoned node appear under the node finding, not as separate workload findings.
The data source is the Kubernetes API and nothing else (decided 2026-10-02): no Prometheus query, no Loki query, no --since window. Every signal the issue names is available from list_node, the pod list, the Warning event list and read_namespaced_pod_log, so the command works on any cluster the CLI can reach, including the devcontainer's minikube, and its tests run offline on tests/k8s_fakes.py.
Shape of the change:
src/devops_cli/k8s/doctor.py: pure functions over SDK objects, read attribute by attribute asmodels/k8s.pyreads them.collect(core, namespace, tail)makeslist_node,list_pod_for_all_namespaces(orlist_namespaced_podunder--namespace),list_event_for_all_namespaces(field_selector="type=Warning")(or the namespaced form) and, only for pods a rule has flagged,read_namespaced_pod_log(tail_lines=…); every call carries_request_timeout=DEFAULT_K8S_CONNECT_TIMEOUT_SECONDS(config/defaults.py:796) asfetch_k8s_statusdoes.diagnose(snapshot)applies the rule table and returns aDoctorReport.- The
CoreV1Apiis built the way_get_k8s_clientbuilds it (ui/data_providers.py:146-163):load_kube_config(context=resolve_context(context))(src/devops_cli/k8s/context.py:78), never a bareload_kube_config().KubernetesServiceis not used, because its list calls carry no timeout and it has no event method. src/devops_cli/models/k8s.py:NodeInfo(name, ready vianode_is_ready, unschedulable, theReadycondition's reason and message, pod count),ClusterEventInfo(whatPodEventInfokeeps plus the involved object's kind, namespace, name and uid),Finding(rule id, severitycritical|warning, classcluster|workload, resourcekind/namespace/name, cause, evidence lines, remediation, affected resources) andDoctorReport(context, counts, findings, errors).src/devops_cli/commands/k8s/diagnostics.py:doctor_cmdregistered asapp.command(name="doctor")insrc/devops_cli/commands/k8s/__init__.py(the 30 registrations at:98-127). Options:--namespace/-n(default: all namespaces, since nodes and PV events are cluster-scoped),--context,--tail(log lines per flagged container, defaultDEFAULT_K8S_DOCTOR_LOG_TAIL_LINES = 200),--format/-f table|json|yamlthroughnormalize_formatandemit_serialized(src/devops_cli/output/serialization.py:71) asgpu-matrixdoes (commands/k8s/gpu_matrix.py:128-154), which is the join point the output-format roadmap item names (docs/ROADMAP.md:629-631), and--dry-run. Kubernetes imports stay inside the function as the otherdiagnostics.pycommands keep theirs.- Exit code (decided 2026-10-02):
0when the report has no findings,2when it has at least one finding,1when the kubeconfig cannot be loaded, the cluster cannot be reached or any list call fails. The code is the same for every--format, so a script can tell "unhealthy" from "could not look". With1the error is printed throughmask_secretsandDoctorReport.errorsnames the call that failed. - Table output through
print_table(src/devops_cli/output/console.py:616); an API error is passed throughmask_secrets(src/devops_cli/security/sanitizer.py:269) as_build_pods_tabledoes (diagnostics.py:52-55). Help strings insrc/devops_cli/lang/en/help.pynext topods(:251). - An MCP tool
k8s_doctorinsrc/devops_cli/ai/mcp/server.pybesidek8s_status(:285-291), runninguv run devops k8s doctor --format jsonthrough_run_mcp_cmd. Because_run_mcp_cmdprefixes every non-zero exit withCommand exited with status N:(server.py:77-78,91-92), the tool's docstring states that status2means findings and the JSON report follows on the next line, and status1means the cluster could not be read. docs/CLI_REFERENCE.mdanddocs/MCP_TOOLS.mdregenerated withuv run devops docs generate(src/devops_cli/commands/docs.py:53,156; pinned bytests/test_docs.py:200-234).
The rule table, held as data, in evaluation order (cluster rules first; a resource claimed by an earlier rule is listed as affected by it, not re-reported):
| id | class | trigger | cause and remediation |
|---|---|---|---|
node-not-ready |
cluster, critical | Ready condition not True |
node unreachable or kubelet down; pods on it are affected; check the node, or drain it |
node-cordoned |
cluster, warning | spec.unschedulable with pods still scheduled on it, or with pending pods whose FailedScheduling event names it |
scheduling disabled; uncordon when maintenance ends |
volume-reclaim-stuck |
cluster, critical | Warning event reason VolumeFailedDelete on a PersistentVolume, or a local-path helper pod Terminating past DEFAULT_K8S_DOCTOR_STUCK_SECONDS |
provisioner cannot delete the volume; detection and reporting only, never deletion (the local-path reclaim item at docs/ROADMAP.md:626-628 owns remediation) |
pod-stuck-terminating |
workload, warning | deletion_timestamp older than DEFAULT_K8S_DOCTOR_STUCK_SECONDS (default 300) |
finalizer or node not responding; name the finalizers |
pod-crashloop |
workload, critical | container waiting CrashLoopBackOff, or last_termination_reason OOMKilled / Error with restarts above DEFAULT_K8S_DOCTOR_RESTART_THRESHOLD (default 3) |
evidence is the tail's error lines; OOMKilled names the memory limit |
pod-image-pull |
workload, critical | waiting reason ImagePullBackOff or ErrImagePull |
image, tag or registry credentials |
pod-unschedulable |
workload, warning | Pending with a FailedScheduling event |
the event message names the resource that is short |
pod-not-ready |
workload, warning | Running with READY short past DEFAULT_K8S_DOCTOR_STUCK_SECONDS of age |
readiness probe failing; evidence is the Unhealthy event |
warning-events |
workload, warning | a Warning event with count >= DEFAULT_K8S_DOCTOR_EVENT_COUNT_THRESHOLD (default 5) on a resource no other rule claimed |
reported with its reason and message |
log-errors |
workload, evidence | a flagged pod whose tail has an error-line share above DEFAULT_K8S_DOCTOR_LOG_ERROR_RATIO, matched by CONST_K8S_DOCTOR_LOG_ERROR_PATTERN |
corroborating evidence attached to the pod's finding, never a finding on its own |
Ranking: cluster findings before workload findings, critical before warning, then by number of affected resources, then restarts, then name. A pod on a NotReady or cordoned node is attributed to the node finding whatever its own symptoms; that is the constraint the issue sets.
Scope
In scope: src/devops_cli/k8s/doctor.py; additions to src/devops_cli/models/k8s.py; doctor_cmd in src/devops_cli/commands/k8s/diagnostics.py and its registration in commands/k8s/__init__.py; help strings; the named defaults and the error pattern in config/defaults.py and config/constants.py; the k8s_doctor MCP tool; regenerated docs/CLI_REFERENCE.md and docs/MCP_TOOLS.md; tests/test_k8s_doctor.py; tests/k8s_fakes.py extended so FakeCoreV1 (:176-209, which today answers only list_pod_for_all_namespaces, list_node and list_namespaced_event) also records list_namespaced_pod, list_event_for_all_namespaces and read_namespaced_pod_log, and node() (:139) takes unschedulable; changelog.d/408.md; and docs/agent/tasks/task-408-cluster-deployment-health-diagnosis-devops-k8s-doctor.md rewritten as Done with the item's milestone (v0.2.27 today; whether it moves to v0.2.28 is decided at the v0.2.25 cut).
The command reads the Kubernetes API only. It writes nothing to the cluster.
Key Questions
- Where does the data come from: the Kubernetes API only, or Prometheus and Loki too? Answered (owner decision, 2026-10-02): the Kubernetes API only. Every signal the issue names is there: node conditions and
spec.unschedulable, container restart counts and waiting or last-termination reasons,Warningevents, and container logs. It works on every cluster the CLI can reach, including the devcontainer's minikube, where no Prometheus is configured (PrometheusConfig.urldefaults toNone,src/devops_cli/config/settings.py:164-166). Tests build ontests/k8s_fakes.pyand never touch the network. The alternatives are real but stay out:devops prometheusalready queries/api/v1/query(src/devops_cli/commands/prometheus.py:146,200) and would add restart rate over a window (kube_pod_container_status_restarts_total, ask8s/monitoring/dashboards/sre-service.json:150reads it);devops k8s logs --loki-url(commands/k8s/cluster_context.py:349-396,src/devops_cli/k8s/logql.py) would add an error rate over time, and the homelab chart ships cluster events and pod logs to Loki (k8s/monitoring/k8s-monitoring-values.yaml:72-78). Both are history the dashboards already show; a Prometheus-backed--sinceis a separate follow-up candidate if the API-only report proves too noisy. With this answer fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 is not a dependency of this item. - What does the exit code say when findings exist? Answered (owner decision, 2026-10-02):
0when the report has no findings,2when it has findings,1when the cluster cannot be reached or a list call fails. There is no single convention to inherit:k8s auditandgpu-matrixexit 1 for everything, whilediff-helmtreats 2 as success-with-differences (diagnostics.py:211-212) andscanandnetworkingalso use 2 (commands/scan.py:893,commands/k8s/networking.py:875). A distinct code lets a script tell "unhealthy" from "could not look". The mapping holds for every--format; thek8s_doctorMCP tool documents theCommand exited with status 2:prefix_run_mcp_cmdadds (server.py:77-78,91-92) as "findings follow". - What is the ranking and cause model? Answered above: a fixed rule table evaluated in order with attribution, no model call.
k8s_diagnostics_promptstays as it is; an AI narrative over the report is a separate candidate. - Does "dashboard panel" mean the TUI Kubernetes tab or a Grafana dashboard? Answered for this item: neither. The owner's placement comment (2026-10-01) splits the command from the panel, so this item delivers the command and the panel becomes a follow-up candidate. For that candidate the TUI Kubernetes tab is the natural place, since it can call
diagnose()on the snapshotfetch_k8s_statusalready holds (K8sSummary,ui/data_providers.py:44-62); a Grafana panel can only run PromQL, cannot reuse the rule table, andk8s-views-global.jsonalready shows the raw signals ("Kubernetes Pods Status Reason", "Container Restarts by namespace"). - JSON output:
--jsonor--format? Answered:--format table|json|yamlthroughemit_serialized, the join point the output-format roadmap item names and thatgpu-matrixin this command group already uses;chaos's bespoke--json+format_json(diagnostics.py:255,270) is the pattern that item retires. - How are logs kept bounded? Answered: logs are read only for pods a rule has already flagged,
--taillines per container (default 200), and are evidence, never a finding on their own. - How does a stuck PersistentVolume reach the report when the PV is cluster-scoped? Answered:
list_event_for_all_namespaces(field_selector="type=Warning")returns events for cluster-scoped objects too (core/v1 writes them in thedefaultnamespace), and the rule matchesinvolved_object.kind == "PersistentVolume"and reasonVolumeFailedDelete. The helper pod stuckTerminatingis joined by the PV name in the pod's volumes or in the event message. - Which cluster? Answered: the configured context through
resolve_context(), overridable with--context, as the TUI does;devops k8s status's bareload_kube_config()is the behaviour the TUI docstring atui/data_providers.py:146-158calls out as wrong and is not copied. - Is any remediation applied? Answered: no. The command reports; it never deletes, uncordons or restarts anything. The local-path reclaim item (
docs/ROADMAP.md:626-628) states the same constraint for volumes.
Acceptance Criteria
-
uv run devops k8s doctor --helplists--namespace,--context,--tail,--formatand--dry-run;tests/test_k8s_doctor.py::test_doctor_is_registered_with_its_optionsruns it throughCliRunnerondevops_cli.commands.k8s.appand asserts the option names as one tuple. - The issue's first case is attributed to the node: with a fake node whose
Readycondition isFalseandspec.unschedulableisTrue, ametrics-serverpod on it with 6 restarts andCrashLoopBackOff, and a healthy pod on a healthy node,diagnose()returns exactly one finding, rulenode-not-ready, naming the node, withmetrics-serverin its affected resources and nopod-crashloopfinding.test_doctor_attributes_crashloop_on_an_unready_node_to_the_nodeasserts(rule ids, resource, affected)as one tuple. - The issue's second case is found: a
Warningevent with reasonVolumeFailedDeletewhose involved object is aPersistentVolume, plus a helper pod with adeletion_timestamp3 days beforek8s_fakes.NOW, yields onevolume-reclaim-stuckfinding naming the PV and the pod, classcluster.test_doctor_reports_a_stuck_volume_reclaimasserts it;FakeCoreV1has no delete method, so any deletion attempt raisesAttributeError. - Each remaining rule has one fixture test (
node-cordoned,pod-stuck-terminating,pod-crashloopwithOOMKilled,pod-image-pull,pod-unschedulable,pod-not-ready,warning-events,log-errors), parametrized overtests/k8s_fakes.pyobjects, asserting(rule, severity, class, resource, remediation is non-empty); thelog-errorscase asserts the evidence lines land on the pod's finding and that no finding has rulelog-errors. - Ranking is pinned:
test_doctor_ranks_cluster_findings_firstbuilds a report with one finding of each class and severity and asserts the ordered rule ids. - Logs are read only for flagged pods:
test_doctor_reads_logs_only_for_flagged_podsreadsFakeCoreV1.callsand asserts the set of(namespace, name, tail_lines)forread_namespaced_pod_logequals the flagged pods with the--tailvalue. - Every API call carries a client-side timeout:
test_doctor_calls_carry_a_timeoutasserts_request_timeout == DEFAULT_K8S_CONNECT_TIMEOUT_SECONDSon every entry inFakeCoreV1.calls. - The command never queries Prometheus or Loki:
test_doctor_uses_the_kubernetes_api_onlyasserts every entry inFakeCoreV1.callsis one oflist_node,list_pod_for_all_namespaces,list_namespaced_pod,list_event_for_all_namespaces,list_namespaced_eventorread_namespaced_pod_log, and thatsrc/devops_cli/k8s/doctor.pyimports nothing fromdevops_cli.commands.prometheusordevops_cli.k8s.logql. -
--namespacenarrows pods and events:test_doctor_namespace_narrows_the_callsasserts the recorded calls arelist_namespaced_podandlist_namespaced_eventwith that namespace andlist_nodeunchanged. -
--format jsonprintsDoctorReport.model_dump():test_doctor_json_output_round_tripsparses stdout and asserts(context, len(findings), findings[0]["rule"]);--format yamlparses withyaml.safe_loadto the same dict. - Exit codes are
0clean,2findings,1unreachable:test_doctor_exit_codesasserts(0, 2, 1)for a healthy snapshot, a snapshot with findings, and aFakeCoreV1(nodes=Exception("Token secret_token_xyz123 failed")), and assertssecret_token_xyz123is not in the output; a second parametrization runs the snapshot with findings under--format jsonand--format yamland asserts the exit code is still2. - A healthy cluster prints one line saying no problems were found and exits
0;--dry-runprints arender_dry_run_resultfordevops k8s doctorwithout loading a kubeconfig and exits0:test_doctor_dry_run_loads_no_configpatcheskubernetes.config.load_kube_configwithside_effect=AssertionErrorastests/test_k8s_logs_diff_chaos.py:124-131patches it. - The
k8s_doctorMCP tool exists, its docstring states thatCommand exited with status 2:means findings follow as JSON, anddocs/MCP_TOOLS.mdanddocs/CLI_REFERENCE.mdare regenerated:uv run devops docs checkpasses. -
changelog.d/408.mdis added;CHANGELOG.mdanddocs/ROADMAP.mdare untouched, whichdevops pr check-readinessenforces for a PR intorelease/*(src/devops_cli/commands/pr.py:1649,1851-1852). - Every new test runs offline in under 1 s (
uv run pytest tests/test_k8s_doctor.py --durations=10), anduv run devops cipasses within its 5-minute budget, including the complexity gate (DEFAULT_MAX_COMPLEXITY = 10,DEFAULT_MAX_NESTING_DEPTH = 5,config/defaults.py:677-678). - Pending a person:
uv run devops k8s doctor --context homelab-k3son the homelab, thenuv run devops k8s doctor --context homelab-k3s --format json | head -40, and confirm the output agrees withkubectl --context homelab-k3s get nodesandkubectl --context homelab-k3s get events -A --field-selector type=Warning, and that the shell's$?is2when the table shows findings and0when it does not.
Out of Scope
- The dashboard panel (TUI or Grafana): split off by the owner's placement comment of 2026-10-01; a follow-up candidate, not yet filed.
- Prometheus or Loki as data sources, restart rates over time, and any
--sincewindow: decided out on 2026-10-02; a Prometheus-backed--sinceis a separate follow-up candidate. - Any remediation action: uncordon, delete, restart, finalizer removal. The local-path reclaim item owns volume cleanup.
- Alert rules and Alertmanager routing (the Alerts fire into nothing: no Alertmanager, and k3s false positives #549 roadmap entry,
docs/ROADMAP.md:1181, v0.2.28); the doctor is a pull-time report, not an alert. - An AI narrative over the report;
k8s_diagnostics_promptstays as it is. - Replacing
devops k8s status,_get_unready_nodes, or the MCPk8s_podstool, which today runsdevops k8s status(server.py:275-282). - Migrating
chaos's--jsonto--format; that belongs to the output-format roadmap item. - Changing
_run_mcp_cmd's non-zero-exit prefix; thek8s_doctortool documents it rather than special-casing status 2.
Dependencies
- fix(ai): the knowledge base names only commands, options and components that exist #920 (v0.2.27, open): a knowledge-base mention of
devops k8s doctorundersrc/devops_cli/ai/knowledge_base/**/*.mdmust land in the same PR as the command or after it, because fix(ai): the knowledge base names only commands, options and components that exist #920's test resolves everydevops …span there against the command tree; this item touches none of the five files that mentiondevops k8s status. - fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858 (v0.2.27, open): trims CLI start-up imports;
doctor_cmdkeeps thekubernetesimport inside the function as the otherdiagnostics.pycommands do, so no conflict is expected whichever lands first. - fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 (v0.2.26, open): not a dependency. It would have been one only with Loki as the log source, and the data source is fixed as the Kubernetes API only.
Sequencing: no open item depends on this one and this item depends on no open item, so it can land at any point in its release; nothing in the cross-release ordering names #408.
Readiness check (2026-10-04)
Checked at b61e5a0 (release/v0.2.26).
Dependencies. None are open:
- fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 is merged (v0.2.26) and is still not a dependency;
- fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858 and fix(ai): the knowledge base names only commands, options and components that exist #920 are ordering notes only;
- the v0.2.25 cut kept this item in v0.2.27, so the task file's milestone is v0.2.27.
Moved citations. The content is unchanged unless stated.
- Constants and defaults:
CONST_K8S_POD_EVENT_FIELD_SELECTOR:constants.py:2304→:2596;DEFAULT_K8S_CONNECT_TIMEOUT_SECONDS:defaults.py:796→:855;- complexity limits:
:677-678→:695and:699.
fetch_k8s_status→data_providers.py:238._get_k8s_clientis still at:146, with the context load at:165.- The caller of
_get_unready_nodes:stack_lifecycle.py:781→:763. - In
ai/mcp/server.py:- the
_run_mcp_cmdprefix:77-78,91-92→:81,:95; k8s_pods→:281;k8s_status→:296;k8s_diagnostics_prompt→:2935,:2957.
- the
- The
podshelp string:help.py:251→:262.commands/k8s/__init__.pynow has 32 registrations, at:99-130. FakeCoreV1→tests/k8s_fakes.py:174, with its methods at:200-206.commands/pr.py:1649,1851-1852→:1661,:1921-1922.PrometheusConfig.url→settings.py:181.- In
k8s-monitoring-values.yaml,clusterEventsis at:86andpodLogsViaLokiat:90. These are Alloy only, since fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548. docs/ROADMAP.mdis now rendered from GitHub:- the local-path reclaim entry (
:626-628) is feat(cli): local-path provisioner volume reclaim failures #410; - the output-format entry (
:629-631) is feat(cli): output format adoption across the command surface #411; - the alerting entry (
:1181) is Alerts fire into nothing: no Alertmanager, and k3s false positives #549, which is delivered.
- the local-path reclaim entry (
Rule alignment: dry run (#412). A dry run makes no request, reads included. It returns the real result type together with the ordered planned requests.
- The pattern is feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741's
PlannedRequest(src/devops_cli/dry_run/requests.py), notrender_dry_run_result. - The command only reads, so it gets no
--plan: its real run is the preview.
Rule alignment: library-first. Three triggers in the body rely on hand-written string checks:
- the
log-errorsregex and line-share threshold (CONST_K8S_DOCTOR_LOG_ERROR_PATTERN,DEFAULT_K8S_DOCTOR_LOG_ERROR_RATIO); - joining a helper pod to a PV through
event.message; - recognising a "local-path helper pod".
None of these is decided, and the simpler form replaces them:
- No log line is classified. A flagged container's tail is attached as evidence on the pod's finding, passed through
mask_secrets. Kubernetes' own fields name the cause:state.waiting.reason,last_state.terminated.reason,exit_codeandmessage. - Both constants are dropped, and
DEFAULT_K8S_DOCTOR_LOG_TAIL_LINESbecomes 20, because the lines are now shown rather than counted. volume-reclaim-stuckfires on theVolumeFailedDeleteevent on aPersistentVolumeonly. A stuck helper pod is reported bypod-stuck-terminating.
Amended criteria:
-
(replaces the
--dry-runhalf of the healthy-cluster criterion)--dry-runloads no kubeconfig, makes no API call and exits 0.- It returns a
DoctorReportwith no findings. Itsrequestslists, in order:list_node, the pod list and theWarningevent list (namespaced under--namespace), thenread_namespaced_pod_logwithtail_linesset to--tail,condition"a rule flags the pod" andrepeat"per flagged container". - Table output prints the requests with
render_request_plan;--format json|yamlcarries them in the report. test_doctor_dry_run_makes_no_requestpatcheskubernetes.config.load_kube_configwithside_effect=AssertionError. It asserts that no client is built and checks the ordered request methods.
- It returns a
-
(replaces the second-case criterion) A
VolumeFailedDeleteevent on aPersistentVolume, plus a helper pod whosedeletion_timestampis 3 days beforek8s_fakes.NOW, yields:- one
volume-reclaim-stuckfinding of classcluster, naming the PV; - one
pod-stuck-terminatingfinding naming the pod, ranked after it.
src/devops_cli/k8s/doctor.pynever readsevent.messageto join objects. - one
-
(replaces the
log-errorspart of the per-rule criterion) The flagged pod's finding carries the tail lines, masked, as evidence, and no finding has rulelog-errors.git grep -nE "LOG_ERROR_(PATTERN|RATIO)" -- srcprints nothing.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Moved from v0.2.25 to v0.2.26 to make room for the seven P1 items left open in the shipped v0.2.23, which were committed earlier. The roadmap-job items placed in v0.2.25 stay, and this item is among the oldest of the rest.
dan-petty commentedon Oct 1, 2026
Moved from v0.2.26 to the backlog to make room for #843 (CI parity), by the owner's decision (2026-10-01). It heads the P1 backlog.
dan-petty commentedon Oct 1, 2026
Placement (2026-10-01): v0.2.27. Value Medium, Effort High. Not Ready yet.
Checked against
release/v0.2.24at d38251e. What stops it being Ready:dan-petty commentedon Oct 3, 2026
Proposed additions from the monitoring cleanup (2026-10-03), for a person to fold in or decline. This item is owner-placed, so its scope is unchanged until then. The cleanup is grouped under #1128.
k8s-monitoring-alloy-*Helm releases are expected, not unknown. alloy-operator creates them from the Alloy CRs.monitoringandkube-systemthat are labelledapp.kubernetes.io/managed-by=prometheus-operatorwhen no prometheus-operator runs.monitoringthat carry no Helm release annotation and come from no manifest in_MANIFESTS_BY_STACK. This catches the next alias or leftover of the kind fix(k8s): the pyroscope Service alias collides with the pyroscope Helm release's own Service, so a fresh deploy-stack can't install Pyroscope #1104 removes (it absorbs chore(k8s): drop the kube-prometheus-stack service aliases #818).Both checks use only the Kubernetes API.
feat(k8s): cluster deployment health diagnosis (devops k8s doctor) (#408
dan-petty-bot commentedon Oct 6, 2026
What changed
#1252, merged into
release/v0.2.27as edd9d2f.18 file(s) changed.
How it was verified
Check runs at f378876:
Acceptance Criteria of
docs/agent/tasks/task-408-cluster-deployment-health-diagnosis-devops-k8s-doctor.md:No Acceptance Criteria section.
feat(release): v0.2.27 (#1257)