8000 🐛 fix alert noise and cause handling by abahmed · Pull Request #635 · abahmed/kwatch · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@

### Dashboard

- Clicking a browser alert while another app is in front now brings the
browser forward on the issue. Before, on macOS, it only picked the
kwatch tab behind the other app, so nothing seemed to happen.
- **What kwatch is watching no longer makes a least-privilege install
look broken.** Kinds kwatch's checks don't need, such as custom
resources the default role leaves out, are counted as "optional, not
in kwatch's role", apart from the blocked ones, and don't fail
"Permissions complete" or the kwatch link's dot. The counts read "54
watched, all of them read", "Permission to add" says how many of the
kinds it can't read its rules cover, and the first read of the
cluster says kwatch follows changes live since then.
- **The Issues page is one list you narrow with filters.** With the
default sort the active issues sit under "Urgent", "Needs attention"
and "Low" headings; each row is the title plus one plain line of why
Expand Down Expand Up @@ -118,6 +129,29 @@

### Incidents and messages

- When kwatch stops watching an incident that is still not healthy, its
closing message starts with ⚪ instead of ✅, so it no longer looks
fixed at a glance. The alert still closes as before.
- An app scaled to zero long ago that an Ingress still routes to stays a
low-priority leftover. Before, a GitOps sync or an operator writing to
it every few minutes made it look newly scaled down: it was sent as
news, then resolved and reopened after each write.
- A new Ingress that routes to an app scaled to zero is news at once,
however old the scale-down is.
- A page whose failure has not changed for 7 days moves to Needs
attention, with one short update that says so, and is then reminded
weekly. A new or worse failure pages again.
- An alert no longer swings between paging and the daily summary while
its workload still has nothing ready and its failures only move to
another incident for a while, as an init container that waits for a
broken Service does. Before, each swing sent two more updates.
- One cause, one incident: a Service with no ready endpoints because
the app behind it fails is part of that app's incident, and so are
the apps that wait for or call it. Before, the Service and each
waiting app opened incidents of their own, and the waiting app's
incident kept moving between them as its init container waited, then
failed. A member that moved to another incident, or whose pod is still
not ready, is no longer said to have recovered.
- A problem that was moved into another incident and later leaves it
while still failing goes back to its own thread: the old incident
opens again and says it is still failing and no longer part of the
Expand Down Expand Up @@ -214,6 +248,32 @@
the restart tells its thread "Cause now known", as without the
restart. Only the falls right after the restore grace are folded into
the digest.
- A Pending pod's message no longer says tolerating a taint would fit
it when its node selector or affinity fits no node anyway. It then
names only the selector, and the fix names a node affinity too.
- Karpenter's own FailedScheduling event is quoted as the autoscaler's
answer: "The autoscaler can't add a node for it: ...".
- Pods of one issue that give the same scheduling reason say it once.
- An update's reasons (the audit log "reason" and the reason fields of
Opsgenie, PagerDuty, Alerta, incident.io, Splunk and New Relic) list
only the failures that hold now. A reason an earlier message named
still routes the update, and the audit log keeps the routed list in
the new "routedReasons" field when it differs.
- An issue's title is written again when a failure it was written for
now belongs to another issue, also when that failure recovered first
and failed again later, or moved while kwatch was restarting.
- The audit log can rebuild which issues are open. An issue that has
audit lines now gets a "resolved" line when it ends without a message
("settled before alerting", moved, merged, retired as an old
problem), and an "update" line when it reopens before its next
message. Both say "unannounced". A resolve into another issue names
it in the new "into" field. Once a day, and at each start, one
summary line lists the open issues in the new "open" and "openCount"
fields.
- The first message after a start no longer goes out without the
dashboard link while kwatch is still reading the Ingresses and
HTTPRoutes, and "dashboard links off: no_route" is no longer logged
for a route that is about to be found.

### Detection

Expand All @@ -237,6 +297,10 @@

### Root cause

- A pod whose node selector or affinity no node meets is blamed on it,
even when the scheduler names a taint first. The scheduler names one
check per node, so tainted nodes hid the selector. Before, the
message blamed the taint and said to add a toleration.
- A zone or node pool that starts failing no longer takes over a
workload that was already failing more than 10 minutes before it,
even when that workload's pods were recreated on the failing nodes.
Expand All @@ -252,6 +316,11 @@

### Security

- Custom kinds named like credentials (tokens, passwords, OAuth codes,
keys) are watched for metadata only, even with `rbac.mode=full`, and
the dashboard never suggests a role rule for them. Its suggested rules
ask for `list` and `watch` only, as the chart grants, not `get`.

- State encryption at rest is available (`state.encryption.enabled`); the key
is in the Secret `kwatch-state-key`, read and updated by that name only.

Expand Down Expand Up @@ -286,6 +355,16 @@
error every hour. The first failure is logged once at info level, with
how to turn telemetry off; repeats log at verbosity 2 and are still
counted by `kwatch_telemetry_failures_total`.
- A least-privilege install no longer warns or reads degraded for the
custom resources its role leaves out: kwatch logs one info line with
their count and how to watch them (`rbac.mode=full`). A refused kind
kwatch's checks need still warns and degrades `coverage`, named first.
The list of refused kinds is no longer logged again at every retry.
- The refused-kinds check is no longer made once only. When RBAC
changes while kwatch runs, a kind kwatch's checks need that becomes
refused warns once and degrades `coverage`, and `coverage` returns to
running when it is granted again. Optional kinds that change log at
verbosity 2 only.

### Helm chart

Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ pointing at Service `<release>-dashboard` (port name `dashboard`).

| `image.repository` / `image.tag` / `image.pullPolicy` | Container image; an empty tag uses the chart's `appVersion` | `ghcr.io/abahmed/kwatch` / `""` / `IfNotPresent` |
| `crd.install` | Install the shared `KwatchConfig` CRD with this release; skipped automatically when another release owns it. `config.crd.enabled` is separate: it turns the live overlay on | `true` |
| `rbac.mode` | `least-privilege` grants an explicit read-only `list`/`watch` set, and kinds outside it (custom resources included) show as `permission_denied` in `/health` coverage (kwatch logs one warning about them and the install notes say so); `full` grants `list`/`watch` on every resource, except that `full` with `watch.secrets: false` renders the least-privilege list. Both grant `get` only on namespaces, nodes, `nodes/stats`, `nodes/metrics` and `pods/log`. Set `full` to watch custom resources | `least-privilege` |
| `rbac.mode` | `least-privilege` grants an explicit read-only `list`/`watch` set, and kinds outside it (custom resources included) show as `permission_denied` in `/health` coverage (kwatch logs one INFO line about them, health is not degraded, and the install notes say so); `full` grants `list`/`watch` on every resource, except that `full` with `watch.secrets: false` renders the least-privilege list. Both grant `get` only on namespaces, nodes, `nodes/stats`, `nodes/metrics` and `pods/log`. Set `full` to watch custom resources | `least-privilege` |
| `persistence.size` | Size of the state volume (PVC). The state file is capped at 512 MiB of logical data (evidence 128 MiB), is rewritten at startup when it grows more than a quarter past that, and no backups are kept; the file and the temporary rewrite copy share the volume | `2Gi` |
| `persistence.existingClaim` | Reuse an existing PVC for the state file | `""` |
| `persistence.emptyDir` | Keep state in an `emptyDir` instead of a PVC. All state is lost when the Pod is rescheduled, so use it only for evaluation; installing with it prints a warning | `false` |
Expand Down
27 changes: 24 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ each with one of `permission_denied`, `api_unavailable`, `cache_sync_failed`,
`sync_timeout` and `budget_exceeded` of earlier versions are still accepted
on input and shown as `cache_sync_timeout` and `watch_budget_exceeded`. Its
`reasons` field counts kinds per reason, so the counts stay complete when the
kind list is cut at 50.
kind list is cut at 50. `optional` counts the `permission_denied` kinds that
kwatch's checks do not need (custom resources and other kinds outside the
least-privilege role), and each such kind is marked `optional: true`; the
list keeps the needed kinds first.

## 🔐 Kubernetes permissions and graceful degradation

Expand All @@ -505,7 +508,7 @@ kwatch never needs write access to monitored workloads. The chart value
| Mode | What it grants |
|:---|---|
| `full` (opt in with the chart value `rbac.mode: full`) | `list` and `watch` on every resource in every API group, so any built-in kind and any CRD, including ones installed later, can be watched |
| `least-privilege` (chart default, and the raw `deploy/deploy.yaml`, which has the same list; `deploy/deploy-no-secrets.yaml` is the same without Secrets) | An explicit `list`/`watch` set for the kinds kwatch understands, including the built-in PriorityClass, RuntimeClass, IngressClass and ReplicationController. Kinds outside it are reported as `permission_denied` in `/health` coverage, detectors that need them stay silent, and custom resources are not covered. After the first complete discovery kwatch logs one warning naming them, `/health` shows a degraded-but-available `coverage` component, and the chart notes say so at install |
| `least-privilege` (chart default, and the raw `deploy/deploy.yaml`, which has the same list; `deploy/deploy-no-secrets.yaml` is the same without Secrets) | An explicit `list`/`watch` set for the kinds kwatch understands, including the built-in PriorityClass, RuntimeClass, IngressClass and ReplicationController. Kinds outside it are reported as `permission_denied` in `/health` coverage, detectors that need them stay silent, and custom resources are not covered. After the first complete discovery kwatch logs one INFO line naming them, as optional; only a refused kind kwatch's checks need logs a warning and shows a degraded-but-available `coverage` component in `/health`, judged again whenever discovery sees the refused kinds change (a warning once per change; `running` again once they are granted). The chart notes say so at install |

In both modes:

Expand Down Expand Up @@ -923,7 +926,9 @@ issue at once. Problems that were already old when kwatch first saw
them follow `oldProblemDays`.

Every message starts with exactly one status emoji and no other: 🔴 page,
🟠 notify, 🟡 low, ✅ resolved. Red is reserved for incidents that page.
🟠 notify, 🟡 low, ✅ resolved, ⚪ stopped watching while still not
healthy (the alert closes, nothing was fixed). Red is reserved for
incidents that page.

Set `app.environment: non-production` on a staging or development cluster
and nothing in it pages: an incident that would page is delivered as Needs
Expand Down Expand Up @@ -1174,6 +1179,22 @@ summary` when the decision was held for that message, `paging` when only
paging tools and issue trackers receive it, and absent for a message of its
own.

The open incidents can be rebuilt from the log: an incident is open from
its first line until a `resolved` line, and open again after a later line.
Every incident that has a line gets a closing line when it closes, also
when no message was sent: such a line has `delivery` `unannounced` and its
reason in `decisionReason` (`settled before alerting`, `moved before
alerting`, `superseded by revised cause`, `listed under old problems`,
`merged into another incident`). A resolve into another incident (moved,
superseded, handed over) names that incident's ID in `into`. A reopen that
has sent no message yet is an `update` line with `delivery` `unannounced`
and `decisionReason` `reopened`. Once a UTC day, and at each start, one
`summary` line with `decisionReason` `open incidents` lists the IDs of
every open incident that has lines in `open` (sorted, at most 500) and
counts them all in `openCount`, so an incident that has been quiet for
weeks can still be confirmed open. The digest's `items` list only the
incidents it names, so they are no open list.

The audit log is not kept in the state file, so it has no retention period of
its own. On `stdout`, retention is whatever your log collector keeps. A file
output is bounded at 10 MiB: kwatch then renames it to `<path>.1`, replacing
Expand Down
13 changes: 10 additions & 3 deletions docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,16 @@ one: a cluster name, the heartbeat, at least one alert channel, Secrets
watched, and complete permissions. "!" marks what needs your action (a
setting not set, or one that fails), "…" only what is still in
progress, such as the first heartbeat ping. The counts of what kwatch watches use
the same words in the card and the details: watched, read, and
"blocked: can't be read". "Last cluster check" shows the first full read
of the cluster until a later check comes.
the same words in the card and the details: watched, read,
"blocked: can't be read" and "optional, not in kwatch's role". Optional
kinds are ones kwatch's checks don't need, such as custom resources: the
default role (`rbac.mode=least-privilege`) leaves them out on purpose,
so they don't fail "Permissions complete" or mark kwatch as needing a
look. "Permission to add" gives `list` and `watch` rules for the kinds
listed, says how many of the kinds kwatch can't read they cover, and
never gives a rule for a kind named like a credential (tokens,
passwords, OAuth codes, keys). "Last cluster check" shows the first full
read of the cluster until a later check comes.

## Issue pages

Expand Down
7 changes: 4 additions & 3 deletions docs/feature-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ CSIStorageCapacities, VolumeAttributesClasses, ClusterTrustBundles,
LeaseCandidates, ResourceClaimTemplates, ResourceSlices, DeviceClasses,
DeviceTaintRules and StorageVersionMigrations. In the least-privilege mode
`/health` coverage shows them as `permission_denied`; that is expected, not a
fault. The Gateway API kinds UDPRoute, BackendTLSPolicy and ListenerSet are in
fault, and the dashboard counts them, with custom resources, as optional. The Gateway API kinds UDPRoute, BackendTLSPolicy and ListenerSet are in
the least-privilege role. An architecture test keeps the chart's
least-privilege role equal to what the source code reads. The list of every
kind and its watch mode is in [Kubernetes coverage](./kubernetes-coverage.md).
The chart's default `rbac.mode` is `least-privilege`: it grants `list` and
`watch` on the per-kind rows above only, so custom resources are not watched
and show as `permission_denied` in the `/health` coverage (kwatch logs one
warning about them after its first discovery, and the install notes say so).
and show as `permission_denied` in the `/health` coverage, marked
optional (kwatch logs one INFO line about them after its first discovery,
and the install notes say so; health is not degraded for them).
The raw `deploy/deploy.yaml` carries the same least-privilege list, and
`deploy/deploy-no-secrets.yaml` drops Secrets from it (it also sets
`KWATCH_WATCH_SECRETS=false`). `rbac.mode: full` grants `list` and `watch`
Expand Down
10BC8
10 changes: 10 additions & 0 deletions docs/incident-lifecycle/reminders.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ Reminders say `still open` when nothing else changed (`reminderEvery` in

- A page (or a held page) is said again once after `PageRemindAfter` (6h),
then every `RemindEvery` (a week).
- A page whose failure had no news for `PageUnchangedFor` (7 days, counted
as for `UnchangedFor` below) is lowered to Needs attention at its next
reminder, which becomes the one update that says so: "Failing unchanged
for 7 days: moved from urgent to needs attention. A new or worse failure
pages again." It reaches the thread and the pagers, adds no message, and
is reminded weekly from then on (`page_unchanged.go`). What its failure
looked like then is saved with the record (`Marks.PageEased`), so a
restart keeps it lowered; a new reason, a wider impact, a new cause or a
new release raises it back to a page as any rise does. A held page is
already Needs attention and is left alone.
- An incident that has no message of its own (digest tier, or one a
roll-up or summary only named and that never spoke since:
`hasOwnMessage`) is said again after `ChronicRemindEvery` (a day), then
Expand Down
14 changes: 14 additions & 0 deletions docs/incident-lifecycle/resolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ and ones restored from the state file. A quietly closed incident is not
reopened as "failing again": a failure that gets worse opens a new one,
which is announced as usual.

## Closes without a message

Some incidents close, or open again, without a decision: one that ends
before alerting (`closeUntold`), a quiet supersede (`resolveQuietly`), an
old problem retired (`retireOldProblems`), a reopen that recovered before
its update (`closeUnheardReopen`), a settling incident merged into
another (`reroot`), and the reopens (`reopen`, `reclaim`, `revive`). For
an incident a decision was made for (`Revision` above zero) each step is
noted (`audit_events.go`); the announcer takes them every tick and writes
one audit line each, with `delivery` `unannounced`
(`pipeline/audit_open.go`). The same file writes, once a UTC day and at
each start, the line that lists the open incidents. A resolve's `into`
is the incident it moved into (`SupersededBy`).

---

Previous: [Reminders](./reminders.md) | Next: [Reopen and supersede](./reopen.md)
1 change: 1 addition & 0 deletions docs/incident-lifecycle/timings.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ read the header there for how they relate.
| `PageRemindAfter` | 6h | a long outage does not go quiet |
| `RemindEvery` / `ChronicRemindEvery` | 7d / 24h, then 3d, 7d | still-open reminders; ones with no message of their own back off |
| `UnchangedFor` | 30d | a problem unchanged this long is reminded at most this often |
| `PageUnchangedFor` | 7d | a page with no news this long is lowered to Needs attention at its next reminder; a new or worse failure pages again |
| `MaterialGap` | 10m | at most one material update per 10 minutes |
| `CauseHold` | 30s | a cause new to the incident is news once it holds this long |
| `FixWatch` | 10m | when to say a fix attempt did not work |
Expand Down
3 changes: 2 additions & 1 deletion docs/production-goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ kwatch does not learn from user feedback. It reasons from the cluster:
## Messages

- Sentences are built dynamically from the facts of the case.
- One status emoji everywhere: 🔴 page, 🟠 notify, 🟡 low, ✅ resolved.
- One status emoji everywhere: 🔴 page, 🟠 notify, 🟡 low, ✅ resolved,
⚪ stopped watching while still not healthy.
- No labels or sections, and no links except the optional "Open in dashboard" link when the dashboard is reachable.
- The startup and upgrade notices are single sentences. Summaries and plain
notices are not sent to PagerDuty, Opsgenie, GoAlert, Zenduty, Squadcast,
Expand Down
Loading
Loading
6B6
0