kubeadapt-k8s-pulse
by authors
High-performance eBPF-based network metrics agent for Kubernetes
About this chart
kubeadapt-k8s-pulse
High-performance eBPF-based network metrics agent for Kubernetes
Overview
The network monitor runs as a DaemonSet on every node. Its eBPF programs count each pod's traffic at the host side of the pod's network interface, and it sends one batch per node per minute to the Kubeadapt agent, which reports it as network cost.
Key Features
- Per-pod traffic: sent and received bytes and packets for each pod, attached with TCX on kernel 6.6 and newer and with classic tc on older kernels
- IPv4 and IPv6: dual-stack accounting on kernel 5.10 and newer
- Pod and node identity: each node's pods are resolved through the Kubernetes API
- Delivery to the agent: batches the agent has not acknowledged are kept and retried
- Overflow handling: flows the kernel table has no room for are carried by a ring buffer instead of being lost
- Prometheus metrics and health endpoints on every node
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/kubeadapt-k8s-pulse --version 1.1.0
Installing the Chart
To install the chart with the release name kubeadapt-k8s-pulse:
helm install kubeadapt-k8s-pulse kubeadapt/kubeadapt-k8s-pulse -n kubeadapt --create-namespace
Or via OCI:
helm install kubeadapt-k8s-pulse oci://ghcr.io/kubeadapt/kubeadapt-helm/kubeadapt-k8s-pulse -n kubeadapt --create-namespace
Note: Using
kubeadapt-k8s-pulseas release name ensures the service name matches Prometheus scrape configurations.
Installed on its own, the DaemonSet serves only its Prometheus metrics. To report network cost, install it through the kubeadapt chart with kubeadapt-k8s-pulse.enabled=true, which also turns on the agent's listener and gives both sides a shared token. To send to an agent installed separately, set config.export.enabled=true, config.export.agentEndpoint and config.export.tokenSecret (a Secret with the agent's token under the key token).
Uninstalling the Chart
To uninstall/delete the deployment:
helm delete kubeadapt-k8s-pulse -n kubeadapt
What the Pod Asks of the Node
Everything the DaemonSet's pod uses beyond an ordinary pod, and why. A platform team can write a policy exception from this table; examples/network-monitor has one each for Pod Security Admission, Kyverno and Gatekeeper.
| What | In the pod spec | Why | Can it go? |
|---|---|---|---|
| Node's network namespace | hostNetwork: true | The programs attach to the host side of every pod's network interface and follow interfaces as pods come and go. Both exist only in the node's network namespace. | No |
| A port of the node | container port 9090 (config.metricsPort) | Health probes and Prometheus metrics. A port of the node only because the pod uses the node's network. Open on every node address, without authentication. | The number can be changed |
| Node's PID and IPC namespaces | not used | ||
| Privileged container | privileged: true (default) | Load and attach the BPF programs, read the node's processes and cgroups. | privileged: false runs it with only the five capabilities below and allowPrivilegeEscalation: false, where the node's security policy allows that set |
| Root user | runAsUser: 0 | The BPF filesystem and the cgroup tree are owned by root. | No |
Capability BPF | capabilities.add, with privileged: false | Create BPF maps and load the programs. | No |
Capability PERFMON | capabilities.add, with privileged: false | The kernel verifier accepts the programs only with it. | No |
Capability NET_ADMIN | capabilities.add, with privileged: false | Attach to pod network interfaces, follow interface changes, read connection tracking. | No |
Capability SYS_RESOURCE | capabilities.add, with privileged: false | Raise the locked-memory limit for BPF maps. | Yes, on kernel 5.11 and newer |
Capability SYS_PTRACE | capabilities.add, with privileged: false | Read other containers' executables for the runtime inventory. | Yes, with EBPF_FINGERPRINT_ENABLED=false in env |
| Every other capability | capabilities.drop: [ALL], with privileged: false | ||
| Root filesystem | readOnlyRootFilesystem: true | Writes go to an emptyDir at /tmp. | |
Host path /proc | read-only, at /host/proc | The node's processes, for the container runtime inventory. | No |
Host path /sys/fs/bpf | writable, propagation HostToContainer, created if missing | The pinned flow table that survives a restart, the lock that keeps one instance per node, and on Cilium its connection tracking maps. | No |
Host path /sys/fs/cgroup | read-only | Find pod cgroups, attach the cgroup programs, read the container's own memory use. | No |
Host path /etc/cni/net.d | read-only, at /host/etc/cni/net.d, created if missing | Identify the CNI and the encapsulation overhead it adds to each packet. | No |
Host path /var/run/ztunnel | only with istioAmbient.enabled: read-only, at /host/var/run/ztunnel, created if missing | Detect an Istio ambient mesh by its socket. | Not mounted by default |
| Seccomp profile | unset (seccompProfile) | The runtime's default profile must allow bpf and perf_event_open before it can be set. | |
| SELinux label | unset (seLinuxOptions) | Set it where the node's policy denies the default container label these operations. | |
| Kubernetes API | ClusterRole: list, watch pods; get nodes; list ciliumenvoyconfigs.cilium.io (rbac.create) | Pod identity for each node's traffic, the node's UID and zone, Envoy detection on Cilium. | Traffic is then reported without pod and node identity |
| Agent token | Secret volume, read-only | The token the agent checks on every batch. | Only with export off |
Against the Pod Security Standards, the privileged container, the host network, the host paths and the node port are outside baseline (with privileged: false, the added capabilities are); root and the unset seccomp profile are in addition outside restricted. The namespace must therefore allow the privileged level.
Image Version
Do not run a network monitor image older than the chart's minimum (the kubeadapt.io/minimum-image-version annotation in Chart.yaml) on a cluster whose CNI or network policy agent attaches classic tc filters to pod interfaces: those images replace that filter, so network policy stops being enforced on the node and stays off after the network monitor is removed. The chart refuses such an image tag. A tag that is not a release version, or one pinned by digest, cannot be compared: it is accepted, and the install notes say so.
Istio Ambient Mesh
Set istioAmbient.enabled=true on a cluster that runs ztunnel. The pod then mounts the node's /var/run/ztunnel read-only, which is how the network monitor tells that a node is in ambient mode. It is off by default because mounting a host directory that does not exist creates it, which would leave an empty directory on every node of a cluster without the mesh.
Scheduling and Rollout
-
Which nodes. One pod per Linux node without taints. The default
tolerationsis empty, so tainted pools (control plane, GPU, spot and other dedicated pools) are not measured; add their taints, or[{operator: Exists}]for every taint.nodeRequirementskeeps the DaemonSet off nodes where its pod can never start (AWS Fargate, virtual-kubelet, other operating systems): no pod is created for them, so none stays Pending. It is applied on top ofnodeSelectorandaffinity. -
Priority. The pod requests 100m CPU and 256Mi. A node whose capacity is already requested has no room for it, when the network monitor is first turned on and again whenever its pod there restarts or is replaced: the DaemonSet deletes the old pod before it creates the new one, nothing holds the room in between, and a workload pod that was waiting takes it within the same second. Kubernetes has no way to keep the room without evicting for it, so there are three choices, described in full in
values.yaml:priorityClassName: ""(default)priorityClass.create: truepriorityClassName: system-node-criticalEvicts workload pods never on a node without room: as few as needed, lowest priority and most recently started first, only below priorityClass.value(1000000)on a node without room: any pod below the node-critical ones First enable on a full node pod Pending, node not measured until room appearsone workload pod evicted in tests; the network monitor starts when that pod has ended (2 s in tests, at most its termination grace period) same Restart or rollout on a full node with workload pods waiting a waiting pod takes the room, network monitor Pendingthe pod that just took the room is evicted before its container starts, network monitor back in 2 s same Can be evicted by any workload with a priority class workloads with a class above priorityClass.valueno workload Rollout and helm upgrade --waitstop when the waiting pods fill the maxUnavailablesharecomplete complete Under node memory pressure ends like any workload container ends like any workload container workload containers are ended first -
Rollout. A change reaches
updateStrategy.rollingUpdate.maxUnavailableof the nodes at a time,25%by default: four waves of well under a minute each, on any number of nodes. A pod that fails to become ready counts against that share, so a bad release stops there; so does a pod that waitsPendingon a node without room. A restart leaves a short gap in that node's measurements and does not touch pod traffic.maxSurgecannot be used, because the pod uses the node's network and only one instance per node attaches. A rollout that is held by waiting pods continues when they start; to push it through, raise the share for that one upgrade (--set updateStrategy.rollingUpdate.maxUnavailable=50%, underkubeadapt-k8s-pulse.in thekubeadaptchart). -
helm upgrade --wait. Helm waits until the rollout has reached every node, so pods that waitPendingcan hold it until the timeout; the release is then markedfailedalthough everything else runs, and--atomicrolls it back. On a large cluster, leave--waitand--atomicout of the upgrade that turns the network monitor on or changes it, and watch the DaemonSet (see Troubleshooting). Helm 4 in addition needs every pod ready by default;--wait=legacygives the Helm 3 rule.
Private Registries
Set image.repository to your copy of the image and, where the registry needs credentials, imagePullSecrets (or global.imagePullSecrets in the kubeadapt chart, which also covers the agent and the upgrade Job). The pull policy is IfNotPresent: release tags are not moved, and a pull on every pod start on every node runs into registry rate limits on a large cluster.
Exported Metrics
Traffic
| Metric | Type | Description |
|---|---|---|
kubeadapt_connection_traffic_bytes_total | Counter | Bytes the node's pods sent, by protocol (use rate() for throughput) |
kubeadapt_connection_traffic_packets_total | Counter | Packets the node's pods sent, by protocol |
kubeadapt_overflow_bytes_drained_total | Counter | Bytes carried by the overflow ring buffer, by protocol; add to the bytes above for the total |
Health
| Metric | Type | Description |
|---|---|---|
kubeadapt_bpf_load_status | Gauge | 1 when the BPF programs loaded |
kubeadapt_attach_mode | Gauge | Attach mode in use (TCX or classic tc) |
kubeadapt_veth_coverage_ratio | Gauge | Share of pod interfaces pulse is attached to |
kubeadapt_bpf_map_utilization_percent | Gauge | Fill level of the kernel flow table |
kubeadapt_pod_resolver_synced | Gauge | 1 when pod identity is available |
kubeadapt_duplicate_pulse_instance | Gauge | 1 when another instance already runs on the node |
kubeadapt_lost_events_total | Counter | Observations that did not reach a batch, by site |
kubeadapt_pulse_retry_buffer_batches | Gauge | Batches waiting for the agent |
kubeadapt_pulse_export_acked_batches_total | Counter | Batches the agent acknowledged |
Values
| Key | Type | Default | Description |
|---|---|---|---|
| affinity | object | {} | |
| capabilities[0] | string | "BPF" | |
| capabilities[1] | string | "PERFMON" | |
| capabilities[2] | string | "NET_ADMIN" | |
| capabilities[3] | string | "SYS_RESOURCE" | |
| capabilities[4] | string | "SYS_PTRACE" | |
| config.connectionTracking | bool | true | |
| config.enableProfiling | bool | false | |
| config.export.agentEndpoint | string | "" | |
| config.export.enabled | bool | false | |
| config.export.tokenSecret | string | "" | |
| config.logFormat | string | "json" | |
| config.logLevel | string | "info" | |
| config.metricsPort | int | 9090 | |
| config.profilingPort | int | 6060 | |
| dnsPolicy | string | "ClusterFirstWithHostNet" | |
| enabled | bool | true | |
| env[0].name | string | "EBPF_RETRY_BUFFER_SIZE" | |
| env[0].value | string | "120" | |
| image.pullPolicy | string | "IfNotPresent" | |
| image.repository | string | `"public.ecr.aws/k2x0t8t6/kubeadapt/ap |
Deploy kubeadapt-k8s-pulse with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kubeadapt-k8s-pulse 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartkubeadapt-k8s-pulse is pinned at v1.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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