ποΈ Architecture overview
This section is for people who want to understand the system, extend it, or debug an unusual alert. Start here, then follow the alert path from detection to delivery.
kwatch is a stateless, single-binary Kubernetes controller that watches cluster resources via informers, detects incidents, builds a dependency graph to explain why they happened, correlates and deduplicates them, and dispatches alerts through 56 providers.
High-Level Architectureβ
βββββββββββββββββββββββββββββββββββββββ
β Kubernetes API Server β
ββββββββββ¬βββββββββ¬βββββββββ¬ββββββββββββ
β β β
ββββββββββββββββ ββββββ ββββββ
βΌ βΌ βΌ
βββββββββββββββββββββββββ ββββββββββββ ββββββββββββββββββ
β Pod Informer β βNode Inf. β βDeploy/Job/DS/ β
β (events, secrets) β β β βCJ/HPA Inf. β
ββββββββββββ¬βββββββββββββ ββββββ¬ββββββ βββββββββ¬βββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Handler (process_*.go) β
β Pod filters β container filters β hints β
β (namespace, reason, state, logs, events, ...) β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ Incident
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Correlation Engine (internal/correlation) β
β β’ Incidents keyed by owner (create/update/resolve)β
β β’ Insight engine: cause, impact, what-changed β
β β’ Dependency graph (podβnode/owner/config) β
β β’ Mass-failure detection (30% blast radius) β
β β’ Smart grouping + cooldown + escalation β
β β’ Node inhibition β
β β’ Resolve hold-down (flap dampening) β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ Enriched Incident
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Alert Manager (internal/alert) β
β β’ 56 providers, one report for all β
β β’ Non-blocking fan-out β
β β’ Retry (only retryable failures) β
β β’ Fallback provider β
β β’ Dead-letter queue β
ββββ¬ββββββββββββ¬ββββββββββββ¬ββββββββββββ¬βββββββββββββ
βΌ βΌ βΌ βΌ
ββββββββ ββββββββββ βββββββββ ββββββββββββ
βSlack β βDiscord β βEmail β βWebhook β ...56 providers
ββββββββ ββββββββββ βββββββββ ββββββββββββ
The source tree under internal/ organizes the controller, handler, correlation,
insight, config, alert providers, and periodic watchdogs. Each is described in
more detail on the following pages.
Continue reading to explore each package, the end-to-end data flow, and the design decisions that shaped kwatch.