From point A to point B
Point A: you've used hubble observe to check one-off things, but not as a working tool. Point B: by the end of this chapter you'll use Hubble to understand an application you don't know, build policies from what you see, get DNS and HTTP visibility, protect sensitive data in the records and send metrics to Prometheus and Grafana.
Hubble architecture
Hubble reads events from the eBPF datapath and enriches them with what Cilium knows about Kubernetes: pods, namespaces, labels, identities and policy verdicts. You don't need to touch the applications.
A server in every agent, Relay for the cluster, and outputs to the CLI, UI, metrics and files. Diagram: The House of Routing.
- Hubble server: it's on by default inside every agent and keeps its node's recent flows in a ring buffer.
- Hubble Relay: gathers the flows from every node into a single API.
- Hubble CLI and Hubble UI: they query Relay.
- Metrics and exporter: outputs for Prometheus and for keeping flows long term.
# A node's local server, from inside the agent
kubectl -n kube-system exec ds/cilium -c cilium-agent -- hubble status
kubectl -n kube-system exec ds/cilium -c cilium-agent -- hubble observe --last 5
Each line is a flow: source, destination, identity (ID:…), observation point (to-endpoint, to-stack…), verdict and TCP flags. Think of a tcpdump that knows Kubernetes.
They include addresses, service names and, with layer 7, HTTP headers. Give access only to those who need it. And avoid kubectl exec into the agent as your usual method: it's a privileged pod.
From node to cluster: Relay
From the agent you only see its node. For the full view, turn on Relay (as in chapter 3) and connect through a port-forward, which gives access to the flows without giving access to the node:
helm upgrade cilium cilium/cilium --version 1.20.3 -n kube-system \
--reuse-values --set hubble.relay.enabled=true
kubectl -n kube-system rollout status deployment/hubble-relay
kubectl -n kube-system port-forward deploy/hubble-relay 4245 &
hubble status # Connected Nodes: 3/3
hubble observe --last 20
hubble observe -P also works, and it opens the port-forward for you. Keep in mind that while an agent restarts, its flows aren't available.
Filtering flows
Imagine you inherit a shop namespace with an undocumented microservices application. Hubble tells you how it talks:
| Filter | What it shows |
|---|---|
-n shop | Flows in the namespace |
--label app=frontend | Flows from pods with that label |
--from-pod shop/frontend / --to-pod | From or to a specific pod |
-t drop / -t policy-verdict | Only drops / only policy decisions |
--verdict DROPPED | By verdict |
--protocol http · --http-status 500 | HTTP traffic / by response code |
-f | Follow live |
-o json | Structured output for jq |
hubble observe -n shop --label app=frontend --last 50
hubble observe -n shop -o json --last 200 \
| jq -r '[.flow.source.labels[0], .flow.destination.labels[0], .flow.l4.TCP.destination_port] | @tsv' \
| sort | uniq -c | sort -rn | head # who talks to whom, and on which port
From drops to policy
Suppose someone applied a policy that denies all ingress in the namespace:
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: deny-all-ingress
namespace: shop
spec:
endpointSelector: {} # every pod in the namespace
ingress:
- {} # a rule that matches nothing: everything is denied
hubble observe -n shop -t drop --last 20
# shop/frontend-… -> shop/cart-…:7070 Policy denied DROPPED
hubble observe -n shop -t drop -o json --last 50 \
| jq -r '[.flow.source.labels[0], .flow.destination.labels[0], .flow.l4.TCP.destination_port, .flow.drop_reason_desc] | @tsv' \
| sort -u
With that you have everything you need to write a precise rule: which source label, which destination label, which port. Repeat the loop until only the necessary traffic gets through.
Observe, question, allow just enough and verify. Diagram: The House of Routing.
Layer 7 visibility
By default, Hubble sees up to layer 4: IPs, ports and flags. To see DNS names and HTTP requests, traffic has to go through the DNS proxy or through Envoy, and you get that with a policy that has layer 7 rules, even if those rules allow everything. Remember that, since it has egress rules, all other egress is denied:
# l7-visibility.yaml · sees DNS and HTTP in the demo namespace; allows DNS, HTTP and HTTPS
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: l7-visibility
namespace: demo
spec:
endpointSelector: {}
egress:
- toEndpoints:
- matchLabels:
k8s-app: kube-dns
io.kubernetes.pod.namespace: kube-system
toPorts:
- ports:
- port: "53"
protocol: ANY
rules:
dns:
- matchPattern: "*"
- toEntities: [world]
toPorts:
- ports:
- port: "80"
protocol: TCP
rules:
http:
- {} # any HTTP request, but going through Envoy
- toEntities: [world] # HTTPS is still allowed, without inspection
toPorts:
- ports:
- port: "443"
protocol: TCP
kubectl create namespace demo
kubectl apply -f l7-visibility.yaml
kubectl -n demo run client --image=nicolaka/netshoot -- sleep infinity
hubble observe -n demo -f &
kubectl -n demo exec client -- curl -s -o /dev/null http://example.com
# demo/client -> example.com:80 (world) http-request FORWARDED (HTTP/1.1 GET http://example.com/)
# demo/client <- example.com:80 (world) http-response FORWARDED (HTTP/1.1 200 …ms)
hubble observe -n demo --protocol http -o json --last 1 | jq '.flow.l7.http'
Now the destination shows up as example.com instead of an opaque IP, and you see the method, URL, code and latency. That hop through Envoy has a cost: turn it on where it adds value.
Hiding sensitive data
With HTTP visibility, headers end up in the flows, including authentication headers:
kubectl -n demo exec client -- curl -s -o /dev/null -H "Authorization: Bearer SECRET-TOKEN" http://example.com
hubble observe -n demo --protocol http -o json --last 1 | jq '.flow.l7.http.headers'
# … "Authorization", "value": "Bearer SECRET-TOKEN"
Turn on redaction so Hubble replaces them with HUBBLE_REDACTED:
hubble:
redact:
enabled: true
http:
urlQuery: true # hides the URL parameters
userInfo: true # hides user:password in the URL
headers:
deny: # or allow: [...] to list only the ones that can be seen
- Authorization
- Cookie
What counts as sensitive is up to your organization. Review it with security before exporting flows to any system.
UI, metrics and export
Hubble UI
helm upgrade cilium cilium/cilium --version 1.20.3 -n kube-system \
--reuse-values --set hubble.ui.enabled=true
cilium hubble ui # or: kubectl -n kube-system port-forward deploy/hubble-ui 8081
It shows a service map per namespace, with flows and verdicts. For details like HTTP headers, go back to the CLI with -o json.
Metrics for Prometheus
prometheus:
enabled: true # agent :9962
operator:
prometheus:
enabled: true # operator :9963
hubble:
metrics:
enableOpenMetrics: true # Hubble :9965
enabled:
- dns
- drop
- tcp
- flow
- icmp
- "httpV2:sourceContext=workload|ip;destinationContext=workload|dns|ip"
You get series like hubble_flows_processed_total, hubble_drop_total (with the reason), hubble_dns_queries_total or hubble_http_requests_total (with code and method). The contexts decide which labels the series carry; the more labels, the higher the cardinality. Since Cilium 1.17 you can change metrics without restarting the agent.
# 5xx error rate per destination service over the last 5 minutes
sum by (destination) (rate(hubble_http_requests_total{status=~"5.."}[5m]))
Keeping flows
The ring buffer is short-term memory. For auditing, the exporter writes flows to a file on each node, which Fluent Bit, Loki or your SIEM then collects:
hubble:
export:
static:
enabled: true
filePath: /var/run/cilium/hubble/events.log
fileMaxSizeMb: 10
fileMaxBackups: 5
Challenge
Answer before you open the solution.
1. You run hubble observe inside an agent and flows are missing. Why?
Because the agent's server only sees its own node. For the whole cluster, use Relay.
2. Which command shows the drops in the shop namespace?
hubble observe -n shop -t drop, plus -o json to see the reason and the details.
3. What do you need to see HTTP requests in Hubble?
A policy with layer 7 rules on that traffic, so it goes through Envoy.
4. How do you keep a token from showing up in the flows?
With hubble.redact, for example by denying the Authorization header.
What you take away
- Hubble enriches eBPF events with Kubernetes context, without touching the applications.
- Relay gives you the cluster view; the port-forward avoids granting access to the node.
- Drops with their reason are the raw material for a minimal policy.
- Layer 7 becomes visible when traffic goes through the DNS proxy or through Envoy.
- Hide sensitive data and send the metrics to Prometheus.
In the last chapter: running Cilium in production.
Official resources
- Network Observability with Hubbledocs.cilium.io
- Monitoring & Metricsdocs.cilium.io
- Configuring Hubble exporterdocs.cilium.io
- Hubblegithub.com
- Prometheusprometheus.io
- Cilium: Up and Running (book)isovalent.com
Source and credits. This chapter summarizes and paraphrases the official book Cilium: Up and Running by Nico Vibert, Filip Nikolic and James Laverack (O'Reilly Media, 2026). The summary was produced with AI and reviewed, verified and approved by Jesús Espinoza. The diagrams and code examples are original work by The House of Routing and were checked against the official Cilium documentation. Cilium: Up and Running, the cover image, and related trade dress are trademarks of O'Reilly Media, Inc. This content is not affiliated with or endorsed by O'Reilly Media or Isovalent.