A Guide to Cilium Hubble: Real-Time Network Traffic and Service Mesh Security Monitoring on Kubernetes

Monitoring tutorial - IT technology blog
Monitoring tutorial - IT technology blog

Comparing Network and Security Monitoring Solutions on Kubernetes

A Kubernetes cluster running dozens of interconnected microservices can easily encounter packet drops or network bottlenecks. Pinpointing the root cause often consumes hours of operational effort. To observe East-West traffic between Pods and enforce robust network security, DevOps engineers typically consider three main approaches:

  • Sidecar Proxy Architecture (Istio / Envoy): Injects an additional proxy container into every Pod to intercept and route all L4/L7 traffic. This model provides powerful metrics collection, distributed tracing, and enforced mTLS authentication.
  • Traditional iptables / Netfilter Logging: Deploys a privileged DaemonSet on every node to parse kernel logs, or relies on NFLOG/tcpdump when packet capture is required for debugging.
  • Kernel-Level Observation via eBPF (Cilium Hubble): Embeds eBPF programs directly into the Linux kernel socket layers and network interfaces. Cilium handles routing and policy enforcement, while Hubble extracts network events directly from the data path without touching the application layer.

Pros and Cons of Each Approach

No single solution is a silver bullet. Every option involves trade-offs between resource overhead and operational complexity:

1. Sidecar Proxy (Istio / Envoy)

Pros: Extremely deep Application Layer (L7) visibility and control. It enables effortless inspection of HTTP paths, headers, and gRPC methods, alongside flexible configurations for circuit breaking and canary deployments.

Cons: High resource consumption and added latency. With Istio Envoy, each proxy container consumes an average of 50MB to 150MB of RAM. In a 500-Pod cluster, you can easily lose more than 50GB of memory just running sidecars. Furthermore, packets must traverse the user-space proxy twice (on send and receive), introducing an additional 2ms to 5ms of latency per request.

2. Traditional iptables Logging / Packet Sniffing

Pros: Highly familiar to most system administrators, leveraging native Linux tooling without requiring architectural overhauls.

Cons: Performance degrades linearly with scale. iptables evaluates rules sequentially from top to bottom. In a cluster with 5,000 Services, the rule set can easily exceed 40,000 lines, causing CPU spikes (via the ksoftirqd process) during frequent network updates. Worse, iptables logs only reveal raw IP addresses, completely lacking Kubernetes context such as Pod names, Namespaces, or Labels.

3. Cilium Hubble (eBPF-Native)

Pros: Near bare-metal wire-speed throughput since processing occurs entirely within the Linux kernel. Operating without sidecar proxies saves tens of gigabytes of cluster memory. Hubble automatically enriches IP flows with full Kubernetes metadata (namespace, pod labels, service identities) in real time.

Cons: Requires a modern Linux kernel (minimum 5.4, with 5.15+ recommended to leverage the full suite of eBPF features). Deep payload inspection for complex encrypted protocols requires more sophisticated parser configurations compared to traditional proxies.

Why Cilium Hubble Is a Game Changer for Kubernetes

On-call troubleshooting is often notoriously frustrating. When a service begins throwing 504 Gateway Timeouts across different nodes, engineers frequently have to SSH into individual machines to run tcpdump. Teams waste precious time staring at raw IP dumps, trying to figure out if packets are being dropped by a bridge, misrouted by a routing table, or silently blocked by iptables.

Cilium Hubble eliminates this friction through its eBPF-native Service Mesh architecture. Hubble delivers millisecond-level flow logs showing exactly which Pod initiated a request, which Pod received it, over which port, and whether it was marked ACCEPT or DROP by a specific rule in your CiliumNetworkPolicy. All of this visibility is delivered with negligible CPU and memory overhead.

How to Deploy Cilium Hubble on Kubernetes

This guide assumes your Kubernetes cluster already runs Cilium CNI (v1.14 or newer). Follow these four steps to enable and monitor your network with Hubble.

Step 1: Enable Hubble and Hubble UI via Helm

If Cilium was installed using Helm, simply update your release values to enable Hubble Relay and the Web UI:

helm upgrade cilium cilium/cilium \
  --namespace kube-system \
  --reuse-values \
  --set hubble.enabled=true \
  --set hubble.relay.enabled=true \
  --set hubble.ui.enabled=true \
  --set hubble.metrics.enabled="{dns,drop,tcp,flow,port-distribution,icmp,http}"

Wait 1 to 2 minutes, then verify that the Hubble pods are healthy and running:

kubectl get pods -n kube-system -l 'k8s-app in (hubble-relay,hubble-ui)'

Step 2: Install the Hubble CLI

The Hubble CLI allows you to inspect network flows directly from your terminal with virtually zero latency:

# Download the stable Hubble CLI binary (Linux amd64)
HUBBLE_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/hubble/master/stable.txt)
curl -L --fail --remote-name "https://github.com/cilium/hubble/releases/download/${HUBBLE_VERSION}/hubble-linux-amd64.tar.gz"
tar xzvf hubble-linux-amd64.tar.gz
sudo mv hubble /usr/local/bin/
rm hubble-linux-amd64.tar.gz

Establish a port-forward tunnel from your local machine to Hubble Relay in the cluster:

cilium hubble port-forward &

Verify that the connection is active:

hubble status

Step 3: Hands-On Real-Time Network Flow Monitoring

Stream real-time network flows across the entire cluster:

hubble observe --follow

Filter specifically for dropped packets (invaluable for debugging connectivity issues or network policies):

hubble observe --verdict DROPPED --follow

Filter traffic by specific namespace and pod:

hubble observe --namespace production --pod payment-service-7f8d6c4-xyz --follow

Inspect detailed HTTP L7 requests (including URL paths and 200/404/500 response codes):

hubble observe --protocol http --namespace production

Step 4: Visualize Service Dependencies with Hubble UI

To launch the Service Dependency Graph dashboard in your browser, run:

cilium hubble ui

This command automatically opens the dashboard at http://localhost:12000. You will see a comprehensive map of inter-service traffic organized by Namespace. Green lines indicate healthy, permitted communication, while red lines highlight traffic blocked by policy. Clicking any node provides an instant breakdown of individual requests, latencies, and network error codes.

Share: