ebpf-agent

by authors

Helm chartv0.2.1App 0.2.0Apache-2.0Verified publisher

High-performance eBPF-based network metrics agent for Kubernetes

About this chart

ebpf-agent

High-performance eBPF-based network metrics agent for Kubernetes

Overview

The eBPF agent runs as a DaemonSet on each Kubernetes node, capturing network packets at the Traffic Control (TC) layer to track pod-to-pod traffic. It exports raw IP-based connection metrics to Prometheus.

Key Features

  • Pod-Level Traffic Tracking: Monitors network traffic between pods using TC eBPF hooks
  • Protocol Support: TCP and UDP traffic with separate tracking
  • IPv4 and IPv6 Support: Full dual-stack support on kernel 5.10+
  • Egress-Only Tracking: Same-node and cross-node across pods
  • Multi-Interface Deduplication: Prevents counting same packet across interface paths
  • Overflow Protection: Ringbuffer captures flows when map reaches capacity

Prerequisites

  • Kubernetes: 1.24+
  • Linux Kernel: 5.10+ (full IPv4+IPv6 dual-stack support)
  • Helm: 3.0.0+

Get Repo Info

helm repo add kubeadapt https://kubeadapt.github.io/kubeadapt-helm
helm repo update

Or use OCI registry:

helm pull oci://ghcr.io/kubeadapt/kubeadapt-helm/ebpf-agent --version 0.2.1

Installing the Chart

To install the chart with the release name kubeadapt-ebpf-agent:

helm install kubeadapt-ebpf-agent kubeadapt/ebpf-agent -n kubeadapt --create-namespace

Or via OCI:

helm install kubeadapt-ebpf-agent oci://ghcr.io/kubeadapt/kubeadapt-helm/ebpf-agent -n kubeadapt --create-namespace

Note: Using kubeadapt-ebpf-agent as release name ensures the service name matches Prometheus scrape configurations.

Uninstalling the Chart

To uninstall/delete the deployment:

helm delete kubeadapt-ebpf-agent -n kubeadapt

Security Requirements

The eBPF agent requires privileged access:

securityContext:
  privileged: true
  capabilities:
    add:
      - SYS_ADMIN    # Load/attach eBPF programs
      - SYS_RESOURCE # Lock memory for BPF maps
      - NET_ADMIN    # Network namespace operations

Additionally requires:

  • hostNetwork: true - Access host network namespace
  • hostPID: true - Track processes for connection attribution

Exported Metrics

Pod-Level Traffic Metrics

MetricTypeDescription
kubeadapt_connection_traffic_bytes_totalCounterCumulative egress bytes (use rate() for throughput)
kubeadapt_connection_traffic_packets_totalCounterCumulative egress packets
kubeadapt_active_connectionsGaugeCurrent active connections

Internal Monitoring Metrics

MetricTypeDescription
kubeadapt_bpf_load_statusGaugeBPF program load status (1=loaded, 0=failed)
kubeadapt_bpf_load_attempts_totalCounterTotal BPF load attempts
kubeadapt_bpf_load_duration_secondsGaugeBPF program load duration
kubeadapt_bpf_map_utilization_percentGaugeBPF map utilization (0-100%)
kubeadapt_overflow_flows_totalCounterFlows sent to overflow ringbuffer
kubeadapt_ip_pairs_batch_sizeGaugeNumber of IP pairs in current batch
kubeadapt_ebpf_collection_duration_secondsHistogramMap collection cycle duration
kubeadapt_collector_errors_totalCounterCollection errors by type
kubeadapt_connection_tracking_infoGaugeConnection tracking configuration info

Values

KeyTypeDefaultDescription
affinityobject{}
config.collectionIntervalstring"25s"
config.connectionTrackingbooltrue
config.dumpBPFMapsboolfalse
config.enableProfilingboolfalse
config.logFormatstring"json"
config.logLevelstring"info"
config.metricsPortint9090
config.profilingPortint6060
enabledbooltrue
envlist[]
image.pullPolicystring"Always"
image.repositorystring"public.ecr.aws/w3l5x6r6/kubeadapt/app/kubeadapt-ebpf-agent"
image.tagstring"v0.2.0"
nodeSelectorobject{}
resources.limits.cpustring"500m"
resources.limits.memorystring"384Mi"
resources.requests.cpustring"100m"
resources.requests.memorystring"128Mi"
serviceAccount.annotationsobject{}
serviceAccount.createbooltrue
serviceAccount.namestring""
tolerationslist[]
topologySpreadConstraintslist[]

Troubleshooting

Agent Won't Start

# Check kernel version (needs 5.10+)
uname -r

# Verify BPF filesystem mounted
ls /sys/fs/bpf

No Metrics Appearing

On the worker node (via SSH):

sudo bpftool prog list | grep tc_
sudo bpftool map list | grep connection_flows

Via kubectl:

kubectl logs -n kubeadapt -l app.kubernetes.io/name=ebpf-agent --tail=50
kubectl port-forward -n kubeadapt daemonset/kubeadapt-ebpf-agent 9090:9090
curl http://localhost:9090/metrics | grep kubeadapt

Deploy ebpf-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ebpf-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartebpf-agent is pinned at v0.2.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply