What is wrong in your cluster right now? No install needed, only Go and a kubeconfig:
go run github.com/guettli/konmon@latest checkIt lists all resources once (every CRD included), prints what is unhealthy, and exits with 1 if something is. It is the successor of check-conditions: see coming from check-conditions.
konmon also watches all resources of a Kubernetes cluster (including every CRD), keeps a local copy with history in SQLite, runs checks written in TypeScript or JavaScript on every object, and sends alerts to Alertmanager.
The 30 core checks (unhealthy status.conditions of any resource, crash-looping or unstartable containers, Services without endpoints, dangling references, and more; ported from check-conditions, k8sgpt and Popeye) are ordinary check files embedded in the binary. Your own checks work exactly the same way: no recompiling, and a check of yours with the name of a core check replaces it.
Conditions have one big advantage over logs and events: they show the current state, and a warning disappears as soon as the desired state is reached. But status.conditions only shows now. konmon records every change, so you can answer "what was wrong at 03:00?" and "when did this machine become not ready?".
watch (dynamic informers, the types the checks need)
API server ───────────────────────────────────────────────────────▶ konmon run
│
┌──────────────────────────────────────────────────────────────┤
▼ ▼
SQLite (konmon.db) every --eval-interval:
objects latest version of every object checks (TS/JS, goja)
revisions gzip copy of every real change → findings table
conditions current conditions per object → Alertmanager
condition_history one row per condition change
findings one row per period a problem was open
usage container CPU/memory per workload and hour
(metrics API, for suggest-requests)
- Change detection ignores noise:
resourceVersion,managedFieldsand condition heartbeats (lastHeartbeatTime,lastProbeTime,lastUpdateTime) are not real changes. A revision or history row is only written if something else changed. - The types the checks need are watched; with the core checks that is nearly all of them, since
conditionsruns on every type which hasstatus.conditions, CRDs included. A type a check runs on (match) is stored; a type a check only reads (reads) stays in memory. Of Secrets, konmon reads only the metadata (the API server never sendsdata; konmon drops the last-applied annotation, which holds a copy of it), and only if a check names them: the core checksecret-missingdoes (--disable-check secret-missingif konmon should not see Secrets at all). Leases, EndpointSlices andevents.k8s.ioare excluded by default since they change all the time (--exclude-resource); a check can still read them. - Deletions while konmon was down are detected after the initial list of each type.
- New CRDs are picked up by re-running discovery (
--discovery-interval). - Findings work like Prometheus alerts: a finding is pending until it has been open for
--for, then it fires. Firing alerts are re-sent on every evaluation; resolved alerts are sent for--resend-resolved.
go install github.com/guettli/konmon@latestOr run it without installing: go run github.com/guettli/konmon@latest <command>.
Binaries for Linux, macOS and Windows are attached to every release, and every release is pushed as ghcr.io/guettli/konmon:<version> (and :latest).
# What is wrong in the cluster right now? Health first, hygiene below.
# Exit code 1: health findings (or hygiene findings of a named check);
# 2: some resource types could not be listed; 3: konmon could not check.
konmon check --context prod
# A check named as an argument fails on its hygiene findings too: a CI gate.
konmon check orphaned -n my-app
# Wait until a condition is gone, or until all is healthy.
konmon check --while StillProvisioning && music
konmon check --while . --timeout 15m
# False positives (e.g. conditions of CRDs konmon does not know): fix them
# interactively; the answers go into a config file (.konmon.yaml without
# --config, created if missing).
konmon triage --context prod
# Monitor: keep the history and send alerts.
konmon run --db konmon.db --config konmon.yaml --alertmanager-url http://alertmanager:9093
# What was wrong two hours ago? What happened to this object?
konmon findings --db konmon.db --at 2h
konmon history --db konmon.db -n kube-system pods/coredns-6799fbcd5-abcde
# Which CPU and memory requests fit what the containers really use?
konmon suggest-requests --db konmon.db
konmon suggest-requests --context prod --live 30m -n my-app # without a databaseIn a cluster: kubectl apply -k 'github.com/guettli/konmon/deploy?ref=main' to try it; for real use pin a release, see Running in a cluster.
- Using konmon:
check,findings,history,suggest-requests, the database - Checks: the core checks, and how to write your own in TypeScript
- Ignoring findings: the config file, teaching condition polarity, escalating findings which stay,
konmon triage - Running in a cluster: manifests, flags, alerts, memory
- CLI reference (generated)
- Contributing
konmon's knowledge about conditions grows with every report. If konmon reports something healthy, misses something, or does something wrong, please tell us. It takes a minute:
konmon report false-positive --check conditions --resource widgets.example.com \
--condition Stalled --status True --reason Waiting
konmon report check-idea --title "detect expired certificates"
konmon report bugEach prints a link to a prefilled GitHub issue (add --open to open it). Nothing is sent automatically, and object names and messages are left out; you see and edit everything before you submit. konmon triage prints the same link after you teach the polarity of a CRD condition. Or open an issue directly: false positive, check idea, bug.
Apache License 2.0. konmon contains code ported from check-conditions, k8sgpt and Popeye, see NOTICE.