How to Filter Kubernetes Flows with the Hubble CLI

The Hubble CLI can narrow a Kubernetes flow stream to the Pod, namespace, and verdict relevant to a connection problem. A useful troubleshooting record shows which workload sent traffic, which workload or address received it, whether the flow was forwarded or dropped, and when it happened. Hubble observes traffic visible to Cilium in the cluster; it is not a complete record of every network path or application payload.
Use an authorized cluster context and a CLI release compatible with the deployed Cilium and Hubble components. Flow records can expose service names, addresses, paths, and identity labels, so limit who can query and export them. The examples assume Hubble Relay is available and that you have permission to query the relevant workloads.
Connect the Hubble CLI Securely
Run kubectl config current-context and confirm that the selected cluster is the one you intend to inspect. Check the Cilium and Hubble deployment with cilium status, then run hubble status -P to test CLI access through Relay. The -P flag opens a temporary local port-forward for that command.
Each online query below includes -P because the connection created by the status command does not remain open for later commands. If your installed CLI lacks this option, keep a separate cilium hubble port-forward session running and omit -P from the queries. Close that separate session when you finish.
Use an account authorized to access the Relay service and the flows you need. A namespace filter limits the query results; it is not an access-control boundary.
If the Relay API uses TLS, follow the deployment's certificate and server-name settings; do not disable certificate checks just to make a command succeed. Add the required --tls, --tls-ca-cert-files, and --tls-server-name settings to each command, using the values supplied for your deployment.
Also check the connected-node count in the status output: a working Relay connection can still provide an incomplete view if some Hubble instances are unavailable.
Select the Namespace and Workload
Start with hubble observe -P --namespace default --last 20, replacing default with the namespace you are authorized to inspect. The namespace filter includes flows with either endpoint in that namespace. Check hubble help observe for the options supported by your installed CLI.
To narrow the query, use hubble observe -P --pod default/example --last 20, replacing default/example with the intended namespace and Pod name. Pod filters match name prefixes, so example can also match names such as example-7c8d. Without an explicit namespace, the Pod filter normally uses default; do not assume it inherits the namespace from your kubectl context.
Identify both source and destination rather than assuming the Pod named in a command is always the sender. The compact output shows arrows, endpoints, ports, and verdicts. A request and its reply can appear in opposite directions. Traffic passing through a service or proxy can show different destination endpoints at different observation points. Compare the flow time and endpoints with the application's own request log.
Filter by Verdict, Protocol, or Destination
To inspect drops, add --verdict DROPPED to the Pod query. To select a direction, use --from-pod and --to-pod instead of the bidirectional --pod filter. For example, replace the namespace, Pod prefixes, and port below with your actual troubleshooting scope:
hubble observe -P --from-pod default/client --to-pod default/server --protocol tcp --to-port 8080 --verdict DROPPED --last 20This query selects observed TCP traffic from the client prefix to the server prefix on destination port 8080. Use --to-ip when the relevant destination is an address rather than an identified Pod. Repeating a verdict option includes either value, while adding a protocol or destination condition narrows the same query.
The --protocol http filter selects HTTP records only when application-layer visibility is enabled. HTTP details require the relevant L7 proxy and policy configuration; changing a CLI filter cannot create missing observations.
Keep one question per query. First inspect a recent sample of flows involving the workload; then compare forwarded and dropped results for the same source, destination, and time window. A filter that is too strict can produce no output even when traffic exists. Clear one filter at a time, confirm the Pod name and namespace, and repeat an authorized test request if the original events may have been overwritten.
Retries can produce several drop records for one connection attempt, so the number of drops alone does not identify the cause. Read the drop reason before attributing a failure to policy. For a controlled comparison, make one request that the existing policy should allow and one that it should deny, then compare the observed events with the application results.
Inspect Direction and Identity
Read the timestamp, source namespace and Pod, destination namespace and Pod or address, port, protocol, and verdict together. A flow showing FORWARDED indicates Cilium allowed that observed step, not that the application returned a successful response. A DROPPED record can result from a policy denial, a malformed packet, or another datapath problem. In structured output, drop_reason_desc identifies the reported cause when available.
Identity labels and policy-related events can help explain why two Pods behave differently. Confirm that the Pods and labels shown in Hubble match the current Kubernetes objects; rolling deployments can replace Pods and change their names. For HTTP traffic with L7 visibility, a method or path may appear in output, which can be sensitive. Flow visibility varies with the deployed Cilium configuration and protocol, and encrypted or unsupported paths may not expose the details you expect.
Export a Recent Flow Sample
For a count-limited query, --last 20 requests up to 20 matching flows from each Hubble instance connected to Relay, not 20 total across the cluster. Older matching records must still be present in those instances' buffers. A time selector such as --since 5m --until 1m instead requests the retained events from five minutes ago through one minute ago; do not combine explicit count and time selectors.
For a one-time export, leave out --follow. Run the following example from a directory with restricted access, substituting your authorized Pod and an unused output filename:
hubble observe -P --pod default/example --verdict DROPPED --last 20 -o jsonpb > dropped-flows.jsonThe shell writes the JSON records to dropped-flows.json; the redirection can overwrite an existing file with that name. The jsonpb format preserves the API response structure, and the output is a stream of JSON objects rather than one JSON array. Keep error messages separate from the exported records and check the command's exit status before using the file.
Keep the command, cluster version, namespace, time range, and test request alongside the exported sample. Redact addresses, URL paths, labels, or other identifiers before sharing it. Prefer the few flows that demonstrate the issue to a broad export of unrelated traffic. If the sample is used to support a policy change, preserve both a permitted flow and a denied flow and record the corresponding application result.
Understand Visibility and Retention Limits
Hubble retains a bounded set of recent flows; the status output reports current and maximum stored flows. Each Hubble instance stores recent events in a ring buffer, so a busy node can overwrite older records sooner than a quiet one. No matching output can mean the event aged out, the filter excluded it, the wrong Relay or cluster was queried, or the traffic did not pass through the observed Cilium path. An empty result is not proof that the traffic never occurred.
Also look for warnings about lost events or disconnected nodes. Hubble can lose observation events when its processing queues fill; that loss is different from a DROPPED verdict for network traffic. Preserve those warnings alongside the sample so an incomplete observation is not mistaken for a complete account of the incident.







