Kubernetes
What the agent reads
Every Kubernetes permission the LevelFour agent and its optional netflow component and JVM reader hold, every field they send to LevelFour, what they never read or send, and what LevelFour reads about an EKS cluster from your AWS account.
The agent is read-only. Its ClusterRole grants only read verbs (get, list and watch; only get on nodes/metrics, nodes/stats and kro instances, and only list on kro ResourceGraphDefinitions), so it cannot create, change or delete anything in your cluster. It installs no webhook and no CRD, holds no cloud credentials, and opens no port to the outside. The optional netflow component and JVM reader are separate and take more. Install the agent and Uninstall the agent cover installing and removing it, and Configure the agent lists its chart values.
The optional automation component is the one part of the chart that changes anything. It has its own service account and its own permissions, which that page lists, and the chart installs it only when you turn it on. It also brings the chart's one webhook and its only CRDs, the six configuration objects in levelfour.ai/v1, which stay when you uninstall.
Permissions
| API group | Resources | Why the agent reads them |
|---|---|---|
| core | pods, nodes, namespaces, persistentvolumeclaims, persistentvolumes | Requests, limits, restarts, placement, node capacity, namespace labels, volume size and owner |
| core | nodes/metrics | CPU, memory and throttling per container, network bytes per pod and node, and used bytes per volume, from the kubelet |
| core | nodes/stats | Ephemeral storage per container and pod, node filesystem use and process counts, from the kubelet Summary API (read-only) |
| core | events | Karpenter's interruption and disruption events on nodes and NodePools. With the JVM reader on, the FailedCreate events on the reader's own DaemonSet |
| core | resourcequotas, limitranges | Each namespace's quota and container limits, so a recommendation fits inside them |
storage.k8s.io | storageclasses | Each StorageClass's provisioner and whether it allows volume expansion, so LevelFour recommends a smaller claim only on a class that can grow |
apps | deployments, statefulsets, daemonsets, replicasets | Which workload owns each pod, and its replica count. On Karpenter's controller, its version and feature gates. With the JVM reader on, the nodes the reader's DaemonSet selects and tolerates |
batch | jobs, cronjobs | Which workload owns each pod |
autoscaling | horizontalpodautoscalers | Scaling targets and current replicas, so a recommendation never fights the autoscaler |
autoscaling.k8s.io | verticalpodautoscalers | The requests a VPA writes get no recommendation; a VPA that only recommends is shown next to ours |
keda.sh | scaledobjects, scaledjobs | Scaling targets of KEDA-scaled workloads |
policy | poddisruptionbudgets | Availability rules that a change must respect, and whether each one allows a disruption right now |
karpenter.sh | nodepools | Capacity types, instance families, limits, consolidation and expiry settings, and the source that deploys each NodePool |
karpenter.k8s.aws | ec2nodeclasses | The node image family behind each NodePool |
eks.amazonaws.com | nodeclasses | The EKS Auto Mode NodeClass behind each Auto Mode NodePool |
eks.amazonaws.com | clusterresourceoptimizationpolicies, resourceoptimizations | EKS Auto Mode's own rightsizing: which workloads it sizes and whether it resizes their pods, so LevelFour leaves those alone |
admissionregistration.k8s.io | mutatingwebhookconfigurations, validatingwebhookconfigurations | Which webhooks act on NodePools, autoscalers or pods, since a webhook that rewrites a field on every write undoes a change made live |
argoproj.io | applications | The repository and path that deploy each workload |
kustomize.toolkit.fluxcd.io | kustomizations | The path that deploys each workload |
source.toolkit.fluxcd.io | gitrepositories | The repository behind each Flux Kustomization |
serving.knative.dev | services, revisions | A KNative Service and its revisions, so a recommendation edits the Service |
kro.run | resourcegraphdefinitions, list only | Which instance field sets each container's requests and limits |
kro.run, and each group in kro.instanceGroups | every resource, get only | The instances that rendered a workload, so a recommendation edits the instance. Instance kinds are each organization's own, so the rule names the API group |
Resources from Karpenter, EKS Auto Mode, KEDA, the Vertical Pod Autoscaler, Argo CD, Flux, KNative or kro are read only when those tools are installed. Of kro's, the agent reads only the ResourceGraphDefinitions and the instances that rendered one of the cluster's workloads, at most 500 instances per hourly summary. The agent works without any of them.
Agent 0.3.0 added the events and storageclasses rows, agent 0.4.1 the resourcequotas, limitranges and nodeclasses rows, and agent 0.8.6 the resource optimization and webhook configuration rows. Upgrading the chart adds them to the ClusterRole, still with read verbs only.
What it sends
The agent sends a usage summary once an hour and a short status check every few minutes. It samples usage every 30 seconds and sends percentiles, never the raw samples.
- Cluster: name, Kubernetes version, cloud provider and region. The cluster's identity is the UID of its
kube-systemnamespace. - Namespaces: name, labels, creation time.
- ResourceQuotas: for each quota, its name and namespace, and the hard and used values of requested CPU and memory, CPU and memory limits, and pods.
- LimitRanges: for each LimitRange with a
Containeritem, its name and namespace, and that item's minimum, maximum, default limit and default request for CPU and memory, and its maximum limit-to-request ratio. - Nodes: name, instance ID, instance type, zone, architecture, capacity type (Spot or On-Demand), node pool or node group, labels, capacity and allocatable CPU, memory, ephemeral storage, GPU and pod slots, CPU and memory usage, the node and image filesystems at their fullest (capacity, used, available, inodes), the process limit and the most processes running at once, how long it was Ready, evictions on it, bytes received and sent on its physical network interfaces, how long it was under memory, disk or PID pressure, its taints, whether it is cordoned, when its deletion started, and whether it is annotated
karpenter.sh/do-not-disrupt: "true". Each node also comes with its manifest askubectl get node -o yamlprints it, cut down to its name, creation time, labels, the annotations listed below, provider ID, taints, whether it is unschedulable, capacity and allocatable, its conditions (type, status, reason, message cut at 512 characters, and when it last changed) and its node info (kubelet and container runtime versions, OS image, kernel version, operating system and architecture). The manifest leaves out the node's addresses, images, volumes,managedFields, machine ID, system UUID, boot ID and each condition's heartbeat time. - Pods: every pod running or waiting to be scheduled at the end of the hour, with its namespace, name, node, owning workload, whether a controller owns it, its priority class, and the CPU and memory it reserves on its node (the larger of its containers' sum and its largest init container, plus pod overhead). Its scheduling rules: required node selector and node affinity terms, required pod anti-affinity (topology key and label selector), topology spread constraints set to
DoNotSchedule(topology key, max skew and label selector), tolerations, and which kinds of node-local storage it mounts (emptyDir on disk, hostPath, local volume). Three annotations leave the cluster as yes-or-no values, never as text:karpenter.sh/do-not-disrupt,cluster-autoscaler.kubernetes.io/safe-to-evict, andkubernetes.io/config.mirror, which marks a static pod. - Workloads: kind, name, namespace, replica counts, pod template labels, how long its pods ran on each node, how long they waited as Pending, evictions, bytes received and sent by its pods (and sent per node), the bytes its pods hold in disk-backed emptyDir volumes, overall and the largest pod per node (secret, configMap, projected and downward API volumes are never counted), whether it runs on the host network, whether topology spread or pod anti-affinity is set, and four annotations:
meta.helm.sh/release-name,meta.helm.sh/release-namespace,argocd.argoproj.io/tracking-id, and any key underlevelfour.ai/. - KNative: each Service as one workload across its revisions, its traffic split and its
autoscaling.knative.dev/*annotations, and each revision's generation, readiness, share of traffic, replicas, and container requests and limits. - kro: the instance that rendered a workload, and for that instance the ResourceGraphDefinition expressions that set its containers' requests and limits, with the instance's current value at each field they read. Nothing else from the instance's spec.
- Containers: name, image, whether a platform such as KNative added it, requests and limits as the workload's spec sets them and as its running pods held them for most of the hour (the two differ after an in-place resize or a mutating webhook; the agent reads the second from the kubelet's report of the resources in force, or from the pod's own spec), CPU, memory and ephemeral storage usage percentiles, restarts, OOM kills, the share of time its CPU was throttled, whether liveness, readiness and startup probes are set, and how it last ended: the reason, exit code, signal and time of the latest termination across the pods that ran in the hour. For a JVM, the heap settings described below. With a DCGM exporter in Prometheus, also GPU utilization percentiles, the most GPU memory it held, and the memory of the GPUs it was given.
- Volumes: name, namespace, phase, storage class, access modes, requested, provisioned and used size, the volume ID, and which workloads mount it.
- StorageClasses: name, provisioner, whether it allows volume expansion, reclaim policy, volume binding mode, its
typeparameter, and whether it is the default class. - Autoscaling: HPA and KEDA targets and replica bounds, the lowest, highest and average replicas over the hour and the time spent at the maximum, VPA update mode, its container policies (which requests it writes on which container) and its current CPU and memory recommendation per container (target, lower and upper bound, uncapped target), PodDisruptionBudget rules with their label selector expressions, how many disruptions each allows right now and how many healthy pods it has and wants, and Karpenter NodePool requirements (with their minimum values), limits, consolidation settings, node expiry, the taints and labels it gives its nodes, the API group and kind of the NodeClass it uses, its own labels, and the same four annotations as workloads. For an EKS Auto Mode NodeClass: its IAM role, ephemeral storage size, IOPS and throughput, network policy and network policy event logs, SNAT policy, and how many subnet and security group selector terms it has, never the terms themselves.
- Who applies each scaling object: for each NodePool, HPA, KEDA ScaledObject and ScaledJob, VPA, PodDisruptionBudget and EKS Auto Mode resource optimization policy, the tools that wrote it, so a change to a field someone declares in Git goes by pull request. For each
managedFieldsentry: the manager's name (such asargocd-controllerorkustomize-controller), whether it applied or updated, the API version and subresource it wrote, when, and which fields of a short list for its kind it owns, such as a NodePool's disruption budgets or an HPA's metrics. Also which of those fieldskubectl.kubernetes.io/last-applied-configurationholds, and the labels and annotations Helm, Argo CD and Flux add:app.kubernetes.io/managed-by,app.kubernetes.io/instance,argocd.argoproj.io/tracking-id,argocd.argoproj.io/sync-options,argocd.argoproj.io/installation-id, and themeta.helm.sh/,kustomize.toolkit.fluxcd.io/andhelm.toolkit.fluxcd.io/keys. - Schedules: a KEDA cron trigger's start, end, time zone and desired replicas, each NodePool disruption budget's schedule, duration and reasons, and each CronJob's schedule and time zone.
- EKS Auto Mode rightsizing: each resource optimization policy's mode, profile, how many workloads it selects and how many opted out, and whether it is ready, never its selectors. For each workload it sizes: the workload, the mode and profile it applies, the policy that won it, and whether it is ready, which says when a VPA holds it back. EKS offers this rightsizing in preview, on Auto Mode clusters running Kubernetes 1.36 or later; on any other cluster there is nothing to read.
- Webhooks: for each mutating and validating webhook, its name, its failure policy, the Service it calls or only that it calls a URL, and the resources and operations its rules match.
- Installed tools: which of the custom resources the agent reads the cluster serves, so a tool that is not installed reads differently from one with nothing configured.
- Karpenter: the controller's version, from its image tag, and its feature gates, from the
FEATURE_GATESenvironment variable on the controller container. - JVM reader: with
jvmReader.enabled, what the JVM reader measured in each container's JVMs, as numbers, and how the reader fared on each node. - JVM heap: for each container that may run a JVM, its maximum and initial heap, and where they came from. A container counts as one on any sign: a JVM's name in its image or command line, an option only a JVM takes, or a variable such as
JAVA_TOOL_OPTIONS,JAVA_OPTSorJVM_OPTSset. The agent reads the heap only from-Xmx,-Xms,-XX:MaxHeapSizeand-XX:InitialHeapSizeamong the options of a plainjavacommand line, or in a literal_JAVA_OPTIONS. Anything else, such as a shell, a variable reference, a value from a ConfigMap or a Secret, or the image's own entrypoint, sends the heap as unresolved. Only the numbers leave the cluster, never the text of the command or the variables. - Node events: events on nodes and NodePools with one of these reasons:
SpotInterrupted,SpotRebalanceRecommendation,CapacityReservationInstanceInterrupted,InstanceStopping,InstanceTerminating,InstanceUnhealthy,TerminatingOnInterruption,Unconsolidatable,DisruptionBlockedandDisruptionTerminating. For each: the object's kind and name, its NodePool, the reason, the count, the first and last time, and the message cut at 512 characters. - Pod events: Warning events on pods with one of these reasons:
BackOff,Unhealthy,FailedScheduling,Evicted,Preempting,FailedMount,FailedAttachVolume,FailedCreatePodSandBox,Failed,ErrImagePull,ImagePullBackOff,FailedPostStartHookandFailedPreStopHook, and the scheduler'sPreemptedevent on a pod it evicted for one of higher priority. For each: the namespace, pod, container, owning workload, type, reason, count, the first and last time, and the message. The API server sends the agent only Warning events andPreempted, so the events of pods starting and stopping never reach it. A message leaves the cluster whole only in a shape Kubernetes itself writes for its reason. Any other message keeps only what comes before its first:, a failed lifecycle hook's message is not sent, credentials the agent recognizes are replaced with[redacted], and every message is cut at 512 characters. - GitOps sources: for Argo CD Applications and Flux Kustomizations, the repository URL, path, revision and values files.
Agent 0.3.0 added the pods, StorageClasses, Karpenter and node events above, and the node taints, cordon, deletion and do-not-disrupt fields, the PodDisruptionBudget status and selector expressions, and the NodePool expiry, minimum values, taints, labels and annotations.
Agent 0.4.1 added the ResourceQuotas, LimitRanges and JVM heap above, the NodeClass each NodePool uses, and the EKS Auto Mode NodeClasses.
Agent 0.6.1 added the requests and limits each container's running pods held, and each node's manifest. Agent 0.6.2 added, for each workload and hour, the most of its pods that ran at once, in all and on each node. From 0.6.3, the agent marks every container that may run a JVM: a JVM's name in its image or command line, a JVM-only option, or a JVM variable set. It sends the maximum and initial heap as numbers only when -Xmx sets them on a plain java command line or in a literal _JAVA_OPTIONS, sends the heap as unresolved otherwise, and no longer sends MaxRAMPercentage.
Agent 0.7.0 added the optional JVM reader and what it measured. Agent 0.7.1 no longer counts LevelFour's own LEVELFOUR_ variables as a JVM variable, so with the reader on, the agent and the reader no longer show as JVM workloads.
Agent 0.8.0 added the pod events above and how each container last ended. Agent 0.8.1 also marks a container as a JVM when only its running pods show one, as when an APM injects JAVA_TOOL_OPTIONS at admission, with its heap sent as unresolved. With the JVM reader on, it adds for each node why no reader runs there and how many processes the kernel hid from the reader.
Agent 0.8.6 added who applies each scaling object, the schedules, EKS Auto Mode's rightsizing, the webhooks and the installed tools above.
What it never reads or sends
This covers the agent. The JVM reader reads more on each node, and lists what it never sends.
The agent cannot read, because its role grants no access:
- Secrets.
- ConfigMaps.
The agent reads pod specs to find requests, limits and scheduling rules, and reads StorageClasses and events too. It drops these before sending:
- Environment variables, command and arguments. The exceptions are
FEATURE_GATESon Karpenter's controller container, and the JVM heap numbers parsed from the settings above. - Every annotation outside the ones listed above. Some annotations, such as
kubectl.kubernetes.io/last-applied-configuration, hold a full manifest: of that one, only which fields of the short list it holds leaves the cluster. managedFieldsbeyond the field names on each kind's short list. Its keys can name environment variables.- A webhook's URL, path and CA bundle.
- StorageClass parameters other than
type, such as an encryption key ID. - Every event outside the reasons listed above.
- KEDA trigger settings other than CPU and memory targets and a cron trigger's schedule. Other triggers can name hosts and queues.
- Probe settings. Only whether each probe is set leaves the cluster, because an exec probe's command can hold a secret.
It never collects logs, packets or request contents. Network data is byte counts only. The agent alone never learns where traffic goes. With the netflow component, a destination reaches LevelFour as a workload name, a zone, node, or the class private or internet, never as an address.
Network
| Direction | Destination | Purpose |
|---|---|---|
| Outbound | api.levelfour.ai, port 443 (HTTPS) | Sends the usage summary and status check |
| In cluster | The Kubernetes API | Reads the resources in the permissions table |
| In cluster | Each node's kubelet, port 10250 | Reads usage through nodes/metrics and nodes/stats, unless you set prometheus.url |
| In cluster, optional | Your Prometheus | Reads usage history, when you set prometheus.url |
| Outbound, optional | api.levelfour.ai, port 443 (HTTPS) | With metrics.costs.enabled, the agent's ingest token also reads this cluster's cost once an hour for the cost metrics. A cluster token reads its own cluster only, and an install key only the clusters it registered |
| In cluster, optional | Each netflow pod, at its node's own address on netflow.port (9188) | Reads the bytes by destination with the netflow token, when netflow.enabled is on |
| In cluster, optional | Each JVM reader pod, at its own address on jvmReader.port (9189) | Reads the JVM samples with the JVM reader token, when jvmReader.enabled is on |
The image comes from public.ecr.aws/levelfour/k8s-agent, built for linux/amd64 and linux/arm64. Each release is signed, and Verify the signatures and SBOM shows how to check it.
What LevelFour reads from your AWS account
For an EKS cluster in an AWS account you connected, LevelFour also reads the cluster's configuration from AWS, every 6 hours, through the same role the account connected with. The agent plays no part in it.
LevelFour finds the cluster on your bill first. EKS bills each cluster's control plane every hour under the cluster's ARN, arn:aws:eks:<region>:<account>:cluster/<name>, so LevelFour matches a cluster by its name, or by the account its nodes' instances bill to.
It then reads, all read-only:
eks:DescribeCluster: status, version and platform version, creation time, endpoint, IAM role, OIDC issuer, authentication mode, upgrade policy, networking (VPC, subnets, cluster security group, public and private endpoint access, IP family, service CIDR), which control plane logs are on, tags and health issues.eks:DescribeClusterVersions: the version's standard and extended support dates, and the newest version.eks:ListAddons,eks:DescribeAddonandeks:DescribeAddonVersions: each add-on, its version and the newest one for the cluster's version.eks:ListInsights: the upgrade insights EKS raises.eks:ListAccessEntriesandeks:ListPodIdentityAssociations: who has access, and which service accounts take an IAM role.eks:ListNodegroupsandeks:ListFargateProfiles: the managed node groups and Fargate profiles.
AWS's ReadOnlyAccess policy grants every one of these (eks:Describe* and eks:List*), and LevelFour's onboarding role carries it. A call your role refuses leaves that part unread and names the IAM action to grant. While a cluster runs on extended support, LevelFour prices it from the extended support hours on your own bill, never from a list price.
Footprint
One replica with requests of 100m CPU and 256 MiB of memory, and limits of 500m CPU and 1 GiB. On a cluster of about 1,300 pods it holds about 300 MiB, with peaks near 1 GiB in its first minutes and when it closes each hour; agent 0.7.1 and earlier set a 512 MiB limit, which a cluster that size outgrows. It runs as a non-root user with a read-only root filesystem and every Linux capability dropped. It exposes its own Prometheus metrics on port 9090 at /metrics, inside the cluster only. With metrics.costs.enabled, that port also serves this cluster's cost, to anyone in the cluster who can reach it.
The netflow component
With netflow.enabled, the chart adds a DaemonSet with its own service account. Each netflow pod reads its node's connection tracking table (conntrack) over netlink every 10 seconds, or every ten times as long as its last read took when that is longer, and turns each connection's byte counters into what each side sent since the last read. It watches only the pods on its own node, names the workload that sent each connection, and keeps per-minute totals for 3 hours for the agent to read.
A receiver with a public IPv4 address counts as internet, and the netflow pod drops the address at once. Every other receiver, a private IPv4 address or any IPv6 address that is not loopback or link-local, keeps its address only as far as the agent, inside the cluster. The agent names it from the pods and nodes it already watches: a pod becomes its workload and zone, a node becomes node, and an address it does not know becomes private inside a private range and internet outside one. No address reaches LevelFour. A node the agent cannot read is named in its status check with what went wrong, never with an address, and the agent's other status errors drop addresses the same way.
| Part | Privilege | Why |
|---|---|---|
| Pod | hostNetwork: true | The conntrack table belongs to the node's network namespace |
netflow container | Runs as root with NET_ADMIN only. Every other capability dropped, no privilege escalation, read-only root filesystem | Reading conntrack over netlink takes CAP_NET_ADMIN, and Kubernetes grants an added capability only to a process running as root |
enable-accounting init container | Privileged, runs once and exits | Conntrack keeps byte counters only when net.netfilter.nf_conntrack_acct is 1, and only a privileged container can write /proc/sys. It writes that one setting |
| Service account | get, list and watch on pods (it lists only its own node's); get on ReplicaSets and Jobs | To name the workload that sent each connection, and a pod's ReplicaSet or Job as its Deployment or CronJob |
nf_conntrack_acct is a node setting and stays on after you uninstall. A connection already open when the netflow pod starts reads zero until it reconnects. If a node turns it off again, or its reads start failing, the agent names that node in its status check.
Each netflow pod listens on its node's own address (status.hostIP) at netflow.port, not on every interface of the node. Its answers hold private addresses, so it answers only a request carrying a token: the chart generates one in a Secret of its own, or reads yours from netflow.existingSecret, and mounts it in the netflow pods and the agent. /healthz stays open for the kubelet's probes, and fails once three read intervals pass without a successful read.
Each netflow pod requests 50m CPU and 32 MiB of memory, with limits of 200m CPU and 256 MiB. It holds about 1 KiB per connection its node tracks, on top of about 30 MiB, and its GOMEMLIMIT follows the container's memory limit, so the default fits about 200,000 tracked connections.
The JVM reader
The pod spec shows a JVM's heap only where -Xmx sits on the command line, and many images size the heap from the container's memory at start. With jvmReader.enabled, the chart adds the JVM reader: a DaemonSet, one pod per node, in a namespace of its own (levelfour-jvm by default). It reads the counters each HotSpot JVM keeps about itself in its hsperfdata buffer: heap, garbage collection and the options it runs with. LevelFour keeps them as the measured heap, which sizes the JVM's container only once LevelFour turns it on for your organization and trusts the measurement.
The reader is off by default, and it takes privileges the agent never holds: read Its privileges before you turn it on. Turn on the JVM reader installs it, with the Pod Security, Kyverno and Gatekeeper exceptions it needs.
What it measures
Each reader pod runs two containers. Every 30 seconds (jvmReader.interval), the probe container lists the node's processes, reads each one's cgroup to find its pod and container, and copies a JVM's hsperfdata mapping out of its memory with process_vm_readv. It does not attach to the JVM or open a file inside the container, and it reads no command line, environment variable or other memory. The agent names the pods the probe may read: of a process in any other pod, the probe reads only its command name, start time and cgroup. The server container keeps three hours of samples, and the agent reads them with a token.
The reader covers every namespace but kube-system, the release namespace and its own. jvmReader.namespaces narrows that to a list.
It reads HotSpot JVMs only, and counts a JVM once it has run for 10 minutes and been seen twice, so a short java command beside the service does not stand for it. The agent sends how many JVMs went unread, by reason:
- No counters. The JVM runs with
-XX:-UsePerfDataor-XX:+PerfDisableSharedMem, cannot write to/tmp, or, before JDK 28, runs as a user with no passwd entry. - OpenJ9. OpenJ9 writes no HotSpot counters.
- Denied or unreadable. The kernel would not show the process's memory map, usually because of a security module such as SELinux, or would not let the probe copy the counters.
- Starting. The JVM had not finished starting.
- Invalid. The mapping did not read as HotSpot counters.
What leaves the node
For each container, across its pods, the agent sends:
- the heap its JVMs may grow to, the least and the most heap they held, the heap committed, the memory outside the heap and the metaspace;
- the share and seconds of garbage collection, the collector and the JDK version;
- these options, as numbers, when the JVM sets them: the maximum and initial heap,
MaxRAMPercentage,InitialRAMPercentage,MinRAMPercentage,MaxRAM,MaxRAMFraction,ActiveProcessorCount,MaxDirectMemorySize,MaxMetaspaceSize,ReservedCodeCacheSize,SoftMaxHeapSize, the thread stack size,ParallelGCThreadsandConcGCThreads, whetherUseContainerSupportandAlwaysPreTouchare on, the collector the options ask for, and whether the JVM cut its record of the options short; - how many JVMs the reader measured and for how long, and how many it could not read, by reason.
Each size is the most any one pod reached, and several JVMs in one container add up. For each node, the agent sends the reader's state (answering, not started, not answering, or none running there), how many JVMs it read, how many it could not tie to a pod, the JVMs it missed, by reason, and how many processes the kernel would not let it see. From agent 0.8.1, a node with no reader says why: an admission check refused the reader's pod, the node has a taint the reader does not tolerate, or jvmReader.nodeSelector leaves it out. For a refused pod the agent reads the reader's own DaemonSet and its FailedCreate events, and sends the refusal the way it sends a pod event's message: Pod Security's and a quota's words whole, and an admission webhook by name only. It leaves out EKS Fargate nodes and virtual kubelets, which run no DaemonSet, so they never count as nodes the reader missed.
The collectors, the reasons and each node's state arrive as words from fixed lists, and everything else as numbers. The agent drops a sample whose identifiers, reasons or numbers fall outside what a real probe sends, and LevelFour refuses a report that carries any other word.
Read on the node, never sent
The probe reads these on the node, and none of them reaches LevelFour:
- The node's process list, and each process's command name, start time and cgroup.
- The memory map of each process outside any pod or in a pod the agent named. The probe looks in it only for the JVM's library and its hsperfdata file.
- The resident memory of each JVM, from which the agent works out the memory outside the heap.
- The hsperfdata buffer copied from each JVM. Beside the counters it holds text, such as the JVM's record of its options. The probe decodes only counters on a fixed list, turns the collector names, the JDK version and the options into enums and numbers, and keeps no text.
- The pod UID, container ID, process ID and start time of each JVM. The agent turns them into the workload and container names it already sends.
No command line, environment variable, path, class path, system property or user name leaves the node.
Its privileges
| Part | Privilege | Why |
|---|---|---|
| Pod | hostPID: true | A JVM in another pod shows only in the node's process namespace |
probe container | Runs as root with SYS_PTRACE only. Every other capability dropped, no privilege escalation, read-only root filesystem, no port | Copying another process's memory with process_vm_readv takes CAP_SYS_PTRACE, and Kubernetes grants an added capability only to a process running as root |
probe container | SELinux level s0:c0.c1023 (jvmReader.seLinuxOptions) | For nodes such as Bottlerocket, as Nodes it runs on explains |
server container | Runs as user 65533 with no capability, no privilege escalation, read-only root filesystem | It keeps the samples and answers the agent |
| Pod and service account | No Kubernetes token mounted, no RBAC | The reader never calls the Kubernetes API |
Namespace (jvmReader.namespace, levelfour-jvm by default) | Pod Security privileged | The baseline level refuses hostPID and SYS_PTRACE |
| NetworkPolicy | Ingress from the agent's pods to jvmReader.port (9189) only, and no egress | Only the agent reads the server |
The probe can read other containers' memory
SYS_PTRACE lets the probe copy any memory of another process, and only the reader's own code keeps it to the JVM counters. Whoever controls the probe can read the memory of any unprivileged container on its node. On Bottlerocket and EKS Auto Mode, SELinux stops it there. On a node without SELinux categories, it reaches the node's other processes too.
Anyone who may create pods in the reader's namespace may also run privileged pods on any node, so restrict who may.
How it is locked down
Four things limit what a compromised probe can do with that access:
- Seccomp. The pod runs under the runtime's default profile. Before it reads anything, the probe adds a filter of its own and checks that it holds. The filter refuses opening a file for writing, creating, deleting or renaming one, exec, ptrace, a new socket or connection, writing another process's memory, a new namespace or mount, loading a kernel module or BPF program, and a signal to any process but the probe.
- No network. The probe has no port. It connects to the server over a Unix socket on a memory volume before its filter goes on, and the NetworkPolicy gives the pod no egress where the network plugin enforces NetworkPolicy.
- No token. No Kubernetes credential reaches the pod, and only the
servercontainer mounts the token the agent presents. - Read only. Its root filesystem and its one volume are mounted read-only, and the filter refuses opening any file for writing.
None of these stops the probe from encoding what it read in the numbers it hands the server.
The server holds no capability. Once it holds its socket and its port, it confines itself with Landlock: it may read only its token's directory and, where the kernel's Landlock covers the network, open no new TCP connection. Landlock also covers binding a new TCP port, but a Linux 7.0 kernel with Landlock ABI 8 let that bind through, so the NetworkPolicy, not Landlock, keeps other pods from reaching a new port. It answers only a request that carries the reader's token, and the agent sends that token only to a pod the reader's DaemonSet controls. The NetworkPolicy keeps other pods away only where the network plugin enforces NetworkPolicy. Elsewhere, the token alone keeps them out.
Nodes it runs on
- Bottlerocket and EKS Auto Mode. Bottlerocket, which EKS Auto Mode runs, keeps containers apart with SELinux categories. The probe may read every container's
/procfiles, but copying a container's memory needs a level that dominates the target's category pair. So the probe runs ats0:c0.c1023, still as the unprivilegedcontainer_ttype, and reaches unprivileged containers only, never a privileged container or the host. A node without SELinux ignores the level. - Tainted nodes. With no
jvmReader.tolerations, the reader runs on untainted nodes only. A JVM on a tainted node goes unread until you add that taint's toleration. From agent 0.8.1, the agent's health shows each such node.jvmReader.nodeSelectornarrows the nodes further. - Kernels without Landlock. On Linux before 5.13, on a kernel built without Landlock among its security modules, or under a container runtime whose seccomp profile refuses Landlock, the server serves nothing and logs
lockdown failed; serving nothingwiththe kernel has no Landlock.jvmReader.requireLandlock=falselets it serve there, unconfined. - Not supported. EKS Fargate, virtual kubelets, Windows nodes, and sandboxed runtimes such as gVisor and Kata. The reader runs on Linux nodes only, and its affinity keeps it off nodes labelled
eks.amazonaws.com/compute-type: fargateortype: virtual-kubelet. The chart does not keep it off nodes with a sandboxed runtime: gVisor and Kata run a pod's processes behind a kernel of their own, so the probe cannot see the JVMs in those pods.
On each node, the probe requests 10m CPU and 48 MiB of memory, with limits of 100m CPU and 128 MiB. The server requests 5m CPU and 32 MiB, with the same limits. Each sets Go's soft memory limit to 85% of its container's memory limit.
Troubleshooting
What each answer in the LevelFour agent's logs means, and how to fix a cluster that does not install, does not report, reports no usage, shows no price or gets no recommendations.
Pricing
Where each cluster's cost comes from on AWS, Google Cloud and Azure, and how to price a cluster that has no cloud bill.