HubbleFlowWindowIncomplete was paging on all three nodes with
perf_event_ring_buffer and observer_events_queue at 0: the gate recorder was
increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]), and that
counter also counts *reads* that fall outside the ring's retained window
(cilium#46584, still open in 1.20.1). Two Hubble UI/status reads an hour
(18:27, 18:35, same minutes on every node) moved it +1 each, which kept the
recorder at ~2.01 and the alert true forever. HubbleFlowLossMaterial used the
same recorder, so a handful of reads could also read as 0.03% "loss" on the
quiet Pi node.
- hubble:lost_events_increase_30m is now real loss only, per (node, source):
increase(hubble_lost_events_total{source=~"perf_event_ring_buffer|observer_events_queue"}[30m]).
HubbleFlowWindowIncomplete and HubbleFlowLossMaterial read it with unchanged
thresholds, so they fire only when something was actually dropped.
- hubble_ring_buffer gets hubble:ring_buffer_read_rate_15m and the new
HubbleRingBufferReadChurn warning at > 0.05 events/s (15m rate, 10m for).
Current churn is ~0.001/s; the F10 health-probe storm was ~0.2/s.
- Both summaries name the source, so a read is never reported as a dropped
flow. HubbleFlowSensorMissing unchanged.
No change to hubble.eventBufferCapacity and no Cilium roll. Docs
(docs/hubble-event-loss.md §"The gate") updated with the split and the
measured reason.
Task: t_397d180a
160 lines
8.5 KiB
YAML
160 lines
8.5 KiB
YAML
# Hubble flow-loss gate (audit F10).
|
|
#
|
|
# The flow stream is the sensor input for every flow-shaped detector
|
|
# (first-seen egress, beaconing shape, east-west novelty). If the agent's ring
|
|
# buffer drops events, a "quiet" window is indistinguishable from a lossy one,
|
|
# and a detector built on it will happily report "all clear" from an incomplete
|
|
# sample. These rules make the loss visible and define the gate: a window whose
|
|
# lost-event count is non-zero is NOT clean and must not be reported as such.
|
|
#
|
|
# Two very different things share the `hubble_lost_events_total` counter and they
|
|
# must not share a threshold:
|
|
#
|
|
# perf_event_ring_buffer / observer_events_queue
|
|
# Real loss on the way in — the BPF perf ring dropped an event, or the
|
|
# metrics exporter fell behind. Steady state is 0 on every node. Any
|
|
# increase over the window taints that window.
|
|
#
|
|
# hubble_ring_buffer
|
|
# NOT a drop. `Ring.read()` synthesises a LostEvent and bumps this counter
|
|
# whenever a read falls outside the ring's retained window, which the
|
|
# agent's own 5 s health probe and every `hubble status` / Hubble UI status
|
|
# request do on a ring holding < 60 s of flows (cilium#46584, still open in
|
|
# the deployed 1.20.1). A couple of UI reads per hour is ~0.001 events/s and
|
|
# means nothing; the 12/min probe storm measured in F10 was ~0.2 events/s.
|
|
# So this source is alerted on a *rate*, never on `increase() > 0`.
|
|
#
|
|
# Recorders:
|
|
# hubble:lost_events_increase_30m real loss only, per (node, source), so the
|
|
# alert can name which source lost events.
|
|
# hubble:ring_buffer_read_rate_15m read churn on the ring, events/s per node.
|
|
# hubble:flows_processed_increase_30m denominator for the material ratio.
|
|
# The detector contract (docs/hubble-event-loss.md §"Gate") is: read
|
|
# `hubble:lost_events_increase_30m` with the same window as the traffic it is
|
|
# judging; if it is > 0, label the window incomplete instead of clean.
|
|
apiVersion: monitoring.coreos.com/v1
|
|
kind: PrometheusRule
|
|
metadata:
|
|
name: hubble-event-loss
|
|
namespace: monitoring
|
|
labels:
|
|
release: kube-prometheus-stack
|
|
spec:
|
|
groups:
|
|
- name: hubble-event-loss
|
|
rules:
|
|
# One number for the gate, from the two sources that mean real loss.
|
|
# `increase()` absorbs the counter reset that an agent restart causes,
|
|
# so a rolled DaemonSet does not look like loss. Empty source filter out
|
|
# of scope: a source that starts reporting is a loss, not a read.
|
|
- record: hubble:lost_events_increase_30m
|
|
expr: |
|
|
sum by (node, source) (
|
|
increase(hubble_lost_events_total{source=~"perf_event_ring_buffer|observer_events_queue"}[30m])
|
|
)
|
|
# Ring-buffer read churn, kept separate and rate-based. 0.05 events/s =
|
|
# 45 reads per 15 min; the F10 probe storm was ~0.2/s, two UI reads an
|
|
# hour is ~0.001/s.
|
|
- record: hubble:ring_buffer_read_rate_15m
|
|
expr: |
|
|
sum by (node) (rate(hubble_lost_events_total{source="hubble_ring_buffer"}[15m]))
|
|
# Denominator for the material-loss ratio. Trace is the total flow
|
|
# counter; L7/Drop/PolicyVerdict are subsets of it and would
|
|
# double-count.
|
|
- record: hubble:flows_processed_increase_30m
|
|
expr: |
|
|
sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))
|
|
|
|
- alert: HubbleFlowWindowIncomplete
|
|
# The gate from F10: any event lost on the way in during the window
|
|
# means a flow-shaped detector may have missed something, so the window
|
|
# must not be reported as clean. Steady state is 0 on all three nodes.
|
|
# Ring-buffer read artefacts are deliberately NOT in this expression —
|
|
# they are not loss and are covered by HubbleRingBufferReadChurn.
|
|
expr: hubble:lost_events_increase_30m > 0
|
|
for: 10m
|
|
labels:
|
|
severity: warning
|
|
component: hubble
|
|
annotations:
|
|
summary: "Hubble lost flow events on {{ $labels.node }} (source: {{ $labels.source }}) — flow windows are not clean"
|
|
description: |
|
|
hubble_lost_events_total{source="{{ $labels.source }}"} on {{ $labels.node }}
|
|
increased by {{ $value | printf "%.0f" }} events over the last 30 min.
|
|
That source is real loss: `perf_event_ring_buffer` means the BPF perf
|
|
ring dropped an event on the way in, `observer_events_queue` means the
|
|
metrics exporter fell behind. A flow-based detector cannot claim
|
|
"no anomalous traffic" for this window.
|
|
Check the agent's flow rate against hubble.eventBufferCapacity in
|
|
infrastructure/networking/cilium/values.yaml, and look for an
|
|
overloaded node.
|
|
|
|
- alert: HubbleRingBufferReadChurn
|
|
# Regression guard for the artefact described in F10, not evidence of
|
|
# loss. The 5 s health probe / `hubble status` / Hubble UI status walk
|
|
# the ring backwards over a full minute; on a ring holding < 60 s of
|
|
# flows each walk increments hubble_lost_events_total
|
|
# {source="hubble_ring_buffer"} by 1. A handful of reads is normal; the
|
|
# old probe storm (12/min = 0.2/s) and an agent whose ring no longer
|
|
# holds a minute of flows are not. Rate, not increase: `increase() > 0`
|
|
# fires forever on two UI reads an hour.
|
|
expr: hubble:ring_buffer_read_rate_15m > 0.05
|
|
for: 10m
|
|
labels:
|
|
severity: warning
|
|
component: hubble
|
|
annotations:
|
|
summary: "Hubble ring-buffer read churn on {{ $labels.node }} (source: hubble_ring_buffer) — reads, not dropped flows"
|
|
description: |
|
|
hubble_lost_events_total{source="hubble_ring_buffer"} is increasing at
|
|
{{ $value | printf "%.3f" }}/s on {{ $labels.node }} (threshold 0.05/s,
|
|
15 min rate, sustained 10 min). This counter also counts reads that
|
|
fall outside the ring's retained window (cilium#46584), so a burst of
|
|
`hubble status` / Hubble UI / relay calls can move it without anything
|
|
being dropped. A sustained rate this high means either a status-call
|
|
storm or a ring holding less than one minute of flows — check
|
|
`hubble status` (Current/Max Flows) against the agent's flow rate and
|
|
hubble.eventBufferCapacity in infrastructure/networking/cilium/values.yaml.
|
|
Confirm whether it is real loss by checking
|
|
HubbleFlowWindowIncomplete (perf/observer sources), which stays 0 for
|
|
read churn alone.
|
|
|
|
- alert: HubbleFlowLossMaterial
|
|
# Escalation: real loss that is large relative to the traffic, not a
|
|
# boundary artefact. 0.1 % of 30 min of flows on siriussec (~180 k
|
|
# events) is ~180 events — small enough to catch a real gap, large
|
|
# enough that a handful of stray increments do not page. Uses the
|
|
# real-loss recorder only; ring-buffer reads never make this ratio.
|
|
expr: |
|
|
(
|
|
sum by (node) (hubble:lost_events_increase_30m)
|
|
/
|
|
(hubble:flows_processed_increase_30m > 0)
|
|
) > 0.001
|
|
for: 15m
|
|
labels:
|
|
severity: critical
|
|
component: hubble
|
|
annotations:
|
|
summary: "Hubble is losing a material share of flows on {{ $labels.node }}"
|
|
description: |
|
|
{{ $labels.node }} has lost more than 0.1% of the flows it processed
|
|
over the last 30 min (ratio {{ $value | humanizePercentage }}), from the
|
|
real-loss sources (`perf_event_ring_buffer` / `observer_events_queue`).
|
|
Treat every flow-based conclusion for this node as partial until
|
|
`hubble:lost_events_increase_30m` returns to 0.
|
|
|
|
- alert: HubbleFlowSensorMissing
|
|
# No series at all is worse than loss: the detector has no input and
|
|
# the gate cannot even evaluate. `absent()` on the recording rule.
|
|
expr: absent(hubble:flows_processed_increase_30m)
|
|
for: 15m
|
|
labels:
|
|
severity: critical
|
|
component: hubble
|
|
annotations:
|
|
summary: "No Hubble flow counters are being scraped"
|
|
description: |
|
|
No `hubble_flows_processed_total` series exist for 15 min. Either the
|
|
`hubble-metrics` scrape targets are down or the Cilium DaemonSet is not
|
|
running; flow-based detection is blind.
|