# 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 -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.