hubble_lost_events_total{source="hubble_ring_buffer"} was climbing at a
constant 12/min on siriussec (72,529 cumulative) and ~4/min on linode with
nothing dropped: Ring.read() synthesises a HUBBLE_RING_BUFFER lost event when
a backwards walk reaches the ring's read boundary, and getFlowRate() walks a
full minute on every hubble status / 5 s health probe / UI request. At
siriussec's ~80 flows/s the 4095-event default only holds ~51 s, so every
probe hit the boundary (cilium#46584).
16383 holds >= 60 s at the 24 h peak on every node (linode 196 flows/s ->
83 s, siriussec 101/s -> 161 s, rpi 38/s -> 431 s), so the walk exits on the
timestamp check instead. Ring accepts 2^n-1 only.
Also wire the sensor gate: recorders hubble:lost_events_increase_30m /
hubble:flows_processed_increase_30m, alert HubbleFlowWindowIncomplete when a
30 min window has any loss (a lossy window may not be reported as clean),
HubbleFlowLossMaterial above 0.1% of processed flows, and
HubbleFlowSensorMissing when the counters disappear entirely.
102 lines
5 KiB
YAML
102 lines
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.
|
|
#
|
|
# Measured loss here is `hubble_lost_events_total{source="hubble_ring_buffer"}`,
|
|
# the only source that has ever been non-zero on this cluster
|
|
# (`perf_event_ring_buffer` and `observer_events_queue` are 0). It is a plain
|
|
# counter on each agent's :9965, scraped by the `hubble-metrics` job.
|
|
#
|
|
# Thresholds:
|
|
# gate : increase over 30 m > 0 events -> warning, window tainted
|
|
# material : lost / processed Trace flows > 0.1 % -> critical, real loss
|
|
# 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. `increase()` absorbs the counter reset that
|
|
# an agent restart causes, so a rolled DaemonSet does not look like loss.
|
|
- record: hubble:lost_events_increase_30m
|
|
expr: |
|
|
sum by (node) (increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]))
|
|
# 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 lost event in the window means a flow-shaped
|
|
# detector may have missed something; the window must not be reported
|
|
# as clean. Steady state is 0 on all three nodes after the ring-depth
|
|
# fix (16383) — this firing means either a regression of that fix or a
|
|
# genuinely overloaded agent, both of which invalidate flow-only
|
|
# silence.
|
|
expr: hubble:lost_events_increase_30m > 0
|
|
for: 10m
|
|
labels:
|
|
severity: warning
|
|
component: hubble
|
|
annotations:
|
|
summary: "Hubble dropped flow events on {{ $labels.node }} — flow windows are not clean"
|
|
description: |
|
|
hubble_lost_events_total{source="hubble_ring_buffer"} on {{ $labels.node }}
|
|
increased by {{ $value | printf "%.0f" }} events over the last 30 min.
|
|
A flow-based detector cannot claim "no anomalous traffic" for this window.
|
|
Check `kubectl -n kube-system exec <cilium-agent> -c cilium-agent --
|
|
hubble status` (Current/Max Flows) and the agent's flow rate against
|
|
hubble.eventBufferCapacity in infrastructure/networking/cilium/values.yaml.
|
|
|
|
- alert: HubbleFlowLossMaterial
|
|
# Escalation: 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.
|
|
expr: |
|
|
(
|
|
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 }}).
|
|
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.
|