Skip to main content

prefect_kubernetes.diagnostics

Kubernetes pod failure diagnostics. Pattern-matches pod status into structured failure diagnoses with actionable resolution hints. Designed to consume the kopf status parameter directly — no extra K8s API calls required.

Functions

diagnose_k8s_pod

Inspect a pod’s status dict and return a diagnosis for known failure conditions. Returns None when the pod is healthy or in a state that does not require user intervention. Args:
  • status: The status field from a Kubernetes pod object (the same dict kopf passes as the status parameter).

Classes

DiagnosisLevel

Severity level for an infrastructure diagnosis.

DiagnosisCategory

Stable, machine-matchable category for a pod-failure diagnosis. These values are emitted as the kubernetes.diagnosis label on replicated pod events, so automations can match on a specific failure mode. Treat the values as a stable contract — do not rename them.

InfrastructureDiagnosis

A structured diagnosis of a Kubernetes pod failure.