POST /pod/traffic
Insert a single observed traffic event. The kguardian controller calls this directly when a network event arrives from one of the eBPF ring buffers; external integrations rarely need it (preferPOST /pod/traffic/batch below for bulk).
Duplicate events (same pod_ip, pod_port, traffic_type,
traffic_in_out_ip, traffic_in_out_port, decision) are deduped
server-side; the check is protocol-aware, branching on the event’s
protocol rather than treating ip_protocol as a plain key column.
The result reported back is inserted-or-Null. The audit forwarder
(when evaluator.enabled: true) is fired only for events that were
genuinely new.
Request
traffic_type is "INGRESS" (matches the upstream NetworkPolicy
casing) or "EGRESS"; decision is "ALLOW" (eBPF observed an
allow) or "DROP" (NetworkPolicy dropped the flow before it
reached the destination, observed via the netpolicy-drop probe).
POST /pod/traffic/batch
Bulk variant taking a JSON array of the same shape. The controller batches up to 100 events at a time (or one second elapsed since last flush, whichever first); call sites talking to a remote broker should use this path to amortise the round-trip. Response is an integer count of the rows actually inserted after dedup.GET /pod/traffic
Get a most-recent-first window of observed traffic rows, ordered(time_stamp DESC, uuid DESC) — newest first, with the UUID
primary key as a tiebreak for microsecond-collision rows from a
single batch ingest. The query is backed by the
idx_pod_traffic_time_stamp index.
Query Parameters
Example
Response
GET /pod/traffic/{name}
Get traffic for a single pod by name. The actix route capturesname directly — no separate namespace path segment — so:
GET /pod/traffic above; same ordering.
A name that doesn’t match any rows returns 404 with body
"No data found". The frontend’s per-pod traffic view handles
this transparently by falling back to an empty list.