Provider Connectors
Configure the agent
Chart values for the LevelFour agent, and how to read Prometheus history, publish cost metrics, measure network by destination, send through a proxy, pull from a private registry and verify the release signatures.
Helm installs and GitOps installs take the same chart values. With GitOps, add them to your values. With Helm, apply a values file over the install you have:
helm upgrade levelfour-agent oci://public.ecr.aws/levelfour/charts/levelfour-agent \
--version 0.6.1 \
--namespace levelfour --reuse-values -f values.yamlSet --version to the chart version you run. Without it, Helm pulls the newest chart and upgrades the agent as well.
Chart values
The chart validates its values and refuses to install when clusterName breaks the naming rule, when neither token nor existingSecret.name is set, when both are, when automation.enabled is true with no automation.allowedNamespaces, when an automation.hardLimits value is not positive, or when an automation key is one it does not know.
| Value | Default | What it sets |
|---|---|---|
clusterName | none | The cluster's name in LevelFour. Required. Lowercase letters, digits and hyphens, at most 63 characters, starting and ending with a letter or digit. Unique across your organization |
token | none | A cluster token (l4k_...) or an install key (l4ki_...). Set token or existingSecret.name, not both |
existingSecret.name | none | A Secret in the release namespace that holds the token or install key |
existingSecret.key | token | The key inside that Secret |
apiUrl | https://api.levelfour.ai | Where the agent sends data. Keep the default |
prometheus.url | none | An in-cluster Prometheus to read usage and history from. See Read history from Prometheus |
kubelet.insecureSkipTLSVerify | false | Skips kubelet certificate checks, for local kind clusters only. On a real cluster it sends the agent's service account token to kubelets the agent cannot verify |
image.repository | public.ecr.aws/levelfour/k8s-agent | The agent image. Point it at your mirror |
image.tag | The chart's version | Leave it unset so the image moves with the chart |
image.digest | none | Pulls the image by digest (sha256:...) instead of by tag |
image.pullPolicy | IfNotPresent | IfNotPresent, Always or Never |
imagePullSecrets | [] | Pull Secrets for a private registry |
nameOverride | none | Replaces the chart name in object names and in the app.kubernetes.io/name label |
fullnameOverride | none | Replaces the whole object name. A release named levelfour-agent names its objects levelfour-agent |
serviceAccount.create | true | Whether the chart creates the agent's service account |
serviceAccount.name | The object name | The service account the agent runs as. With create: false, name one that exists |
serviceAccount.annotations | {} | Annotations on the service account the chart creates |
commonLabels | {} | Labels added to every object the chart creates |
podAnnotations | {} | Annotations on the agent pod |
podLabels | {} | Labels on the agent pod, added to the chart's own |
priorityClassName | none | The PriorityClass of the agent pod |
podSecurityContext | Non-root user and group 65532, RuntimeDefault seccomp | The pod security context |
containerSecurityContext | No privilege escalation, read-only root filesystem, every capability dropped | The container security context |
resources | See Footprint | CPU and memory requests and limits |
metrics.port | 9090 | The port that serves /metrics and /healthz |
metrics.costs.enabled | false | Also serves this cluster's cost on /metrics. See Cost metrics for your Prometheus |
serviceMonitor.enabled | false | Creates a Prometheus Operator ServiceMonitor for /metrics. Needs the monitoring.coreos.com CRDs |
serviceMonitor.labels | {} | Labels your Prometheus selects ServiceMonitors by |
grafanaDashboard.enabled | false | Creates a ConfigMap with a LevelFour cost dashboard for Grafana's dashboard sidecar. Needs metrics.costs.enabled |
grafanaDashboard.labels | grafana_dashboard: "1" | Labels the sidecar loads dashboards by |
netflow.enabled | false | Runs the netflow DaemonSet. See Network by destination |
netflow.existingSecret.name | none | A Secret in the release namespace that holds the token the agent and the netflow pods share, instead of the one the chart generates. Set it for GitOps installs. See Network by destination |
netflow.existingSecret.key | token | The key inside that Secret |
netflow.port | 9188 | The port each netflow pod answers the agent on, at its node's own address. The pods use the node's network, so pick a port free on every node |
netflow.resources | Requests 50m CPU and 32 MiB, limits 200m CPU and 256 MiB | CPU and memory of each netflow pod. See the memory sizing under Network by destination |
netflow.tolerations | Tolerates every taint | Runs a netflow pod on every node, tainted ones included, so no node's traffic goes uncounted |
netflow.priorityClassName | none | The PriorityClass of the netflow pods |
kro.instanceGroups | [] | API groups of kro instances outside kro.run. See KNative and kro |
extraEnv | [] | Extra environment variables for the agent, such as a proxy |
nodeSelector | kubernetes.io/os: linux | Node selector for the agent pod |
tolerations | [] | Tolerations for the agent pod |
affinity | {} | Affinity rules for the agent pod |
automation.enabled | false | Installs the automation component and its configuration objects, with its own service account and permissions. It changes nothing until an object or an admin in the dashboard turns automation on |
automation.allowedNamespaces | [] | The namespaces the component may change. Required when automation.enabled is true. ["*"] grants it the whole cluster and makes it watch every pod, so a list is lighter on a big cluster |
automation.hardLimits.maximumCores | 8 | The most CPU, in cores, the component or its webhook sets on one container, request or limit, whatever an object or the dashboard asks for. A container never goes past double its workload's own spec either way |
automation.hardLimits.maximumGiB | 16 | The same ceiling for memory, in GiB |
automation.revert.allowPodEviction | false | Lets a revert evict a pod whose memory limit cannot go back down in place, on Kubernetes 1.33 and 1.34. Only this value allows an eviction |
automation.resources | requests 20m, 128Mi; limits 200m, 256Mi | The component's own resources. Its pod cache grows with the pods in the allowed namespaces, so raise the memory limit for ["*"] on a big cluster |
automation.priorityClassName | none | The PriorityClass of the component's pod and of the webhook's pods |
automation.webhook.enabled | false | Installs the admission webhook that gives each new pod of a rightsized workload its values. Needs automation.enabled, and the control plane must reach its pods on port 9443 |
automation.webhook.resources | requests 20m, 64Mi; limits 200m, 128Mi | Each webhook pod's resources. Its cache holds the rightsized values of the allowed namespaces |
Read history from Prometheus
The agent measures usage from the kubelet on each node, so it needs no Prometheus. If the cluster already runs one, such as kube-prometheus-stack, point the agent at it. At its first start the agent reads up to 14 days of history from Prometheus, so the first recommendations can come sooner than 7 days after install.
prometheus:
url: http://prometheus-operated.monitoring.svc:9090With Helm, set it on the command line:
helm upgrade levelfour-agent oci://public.ecr.aws/levelfour/charts/levelfour-agent \
--version 0.6.1 \
--namespace levelfour --reuse-values \
--set prometheus.url=http://prometheus-operated.monitoring.svc:9090The agent queries Prometheus from inside the cluster. LevelFour never connects to it, and nothing is exposed outside the cluster.
GPU usage from DCGM
When the same Prometheus scrapes NVIDIA's DCGM exporter, the agent also reads each container's GPU utilization and GPU memory, and the workload drawer shows them beside the GPUs it requested. The exporter's Helm chart creates the ServiceMonitor that kube-prometheus-stack picks up. Without the exporter, GPU usage reads as not measured, and nothing else changes.
Cost metrics for your Prometheus
With metrics.costs.enabled, the agent's ingest token also reads this cluster's cost from LevelFour once an hour, and the agent republishes it in the cluster on the same /metrics port, to anyone who can reach that port. Chart your LevelFour cost in your own Grafana, next to the rest of your metrics.
metrics:
costs:
enabled: true
serviceMonitor:
enabled: true
labels:
release: kube-prometheus-stack
grafanaDashboard:
enabled: trueEach series carries a window label: last_day, the last day the bill priced, or month_to_date. Each window carries the 500 costliest workloads, and sums the rest into one series whose namespace, kind and workload are __other__.
| Metric | What it is |
|---|---|
levelfour_namespace_cost_usd{namespace,window} | A namespace's cost |
levelfour_workload_cost_usd{namespace,kind,workload,window} | A workload's cost |
levelfour_workload_waste_usd{namespace,kind,workload,window} | The cost of what a workload requested and did not use |
levelfour_cluster_idle_cost_usd{window} | The cost of node capacity no workload requested |
levelfour_cost_day_timestamp_seconds | The start of the last priced day, as a Unix time. 0 until a day is priced |
serviceMonitor.labels has to match what your Prometheus selects. kube-prometheus-stack selects ServiceMonitors labelled release: <its release name>, and its Grafana dashboard sidecar loads ConfigMaps labelled grafana_dashboard: "1", the chart's default (kube-prometheus-stack values).
When a read fails, or LevelFour answers in a currency other than US dollars, the agent keeps serving the last values it had, and levelfour_cost_day_timestamp_seconds shows how old they are. A scrape always sees one whole refresh.
Network by destination
The agent counts the bytes each workload sends, but not where they go. With netflow.enabled, the chart adds a DaemonSet, one pod per node, that measures where: a workload in the same zone or another zone, a node, a private address outside the cluster, or the internet. LevelFour then splits each node's data transfer bill by it, so cross-zone and internet egress cost lands on the workloads that cause it. AWS bills a byte that crosses zones on both nodes, the one it leaves and the one it reaches, so the cost of a zone pair counts both ends.
netflow:
enabled: trueEach netflow pod reads its node's connection tracking table (conntrack) every 10 seconds, or every ten times as long as its last read took when that is longer, and watches only the pods on its own node. 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. The agent reads each node one minute late, and tries a node twice more after a connection failure, a server error or a refused token before that window goes without it. Reading conntrack takes privileges the agent never has: The netflow component lists each one and why.
The netflow pods answer only the agent, with a token they share. The chart generates it in a Secret of its own. Argo CD and Flux render the chart with helm template, which generates a new token on every sync, so the netflow pods would refuse the agent until both sides reload. For a GitOps install, create the token once in the release namespace and point the chart at it:
kubectl -n levelfour create secret generic levelfour-netflow-token --from-literal=token="$(openssl rand -hex 32)"netflow:
enabled: true
existingSecret:
name: levelfour-netflow-tokenEach netflow pod holds about 1 KiB per connection its node tracks, on top of about 30 MiB, and its GOMEMLIMIT follows the container's memory limit. The default 256 MiB fits about 200,000 tracked connections. Check a node with cat /proc/sys/net/netfilter/nf_conntrack_count, and raise netflow.resources.limits.memory for busier nodes.
Netflow sees only traffic that passes through the node's netfilter. Cilium with eBPF host routing, which Cilium turns on together with eBPF kube-proxy replacement when the kernel supports it, and Cilium's installNoConntrackIptablesRules both bypass it, so netflow reads nothing there. Cilium with bpf.hostLegacyRouting=true works. Cilium's tuning guide describes both settings.
Netflow also misses:
- Pods on the host network. Their traffic is the node's own.
- A connection whose conntrack entry is gone before the next read. The kernel keeps a closed TCP connection's entry for 2 minutes by default, so short requests count in full. What can go missing is a connection reset by either side, whose entry lasts 10 seconds, and an entry the kernel drops early because the table is full.
- Traffic to a pod that ended before the agent read the window. The agent no longer knows that pod, so the traffic counts as
privateorinternetby its address. - Windows nodes. The DaemonSet runs on Linux nodes only.
The Network view on the cluster page shows the result under By destination: bytes and cost between each pair of zones, internet egress per workload, and how the measured gigabytes compare with the gigabytes the bill charged.
Behind a proxy
The agent sends data to api.levelfour.ai on port 443. If the cluster reaches the internet through a proxy, set HTTPS_PROXY for the agent with extraEnv. Set NO_PROXY to your in-cluster addresses so the agent still reaches the kubelets and the API server directly: .svc, .cluster.local, the service CIDR, and the pod and node CIDRs.
extraEnv:
- name: HTTPS_PROXY
value: http://proxy.example.com:3128
- name: NO_PROXY
value: .svc,.cluster.local,172.20.0.0/16,10.0.0.0/16Replace the CIDRs with your cluster's. The API server's in-cluster address sits in the service CIDR. On Amazon EKS, read it with:
aws eks describe-cluster --name YOUR_EKS_CLUSTER \
--query cluster.kubernetesNetworkConfig.serviceIpv4Cidr --output textPrivate registry mirror
To pull the agent from your own registry, copy the image there and point the chart at it. Copy both architectures (linux/amd64 and linux/arm64) and keep the tag, because the chart pulls the tag that matches its version. crane copy copies every architecture by default; with skopeo copy, pass --all.
crane copy public.ecr.aws/levelfour/k8s-agent:0.6.1 registry.example.com/levelfour/k8s-agent:0.6.1image:
repository: registry.example.com/levelfour/k8s-agent
imagePullSecrets:
- name: registry-credentialsregistry-credentials is a kubernetes.io/dockerconfigjson Secret in the levelfour namespace. To pin the exact image you verified, set image.digest to the digest crane digest public.ecr.aws/levelfour/k8s-agent:0.6.1 prints. crane copy keeps that digest.
To mirror the chart as well, pull it and push it to your registry, then install from oci://registry.example.com/levelfour/charts/levelfour-agent:
helm pull oci://public.ecr.aws/levelfour/charts/levelfour-agent --version 0.6.1
helm push levelfour-agent-0.6.1.tgz oci://registry.example.com/levelfour/chartsVerify the signatures on the public copies before you mirror them.
Verify the signatures and SBOM
LevelFour signs every agent image and chart with cosign, and attaches an SPDX SBOM to each image as a signed attestation. The signing key stays in AWS KMS. Check a release with the LevelFour public key and cosign 3 or later.
Download the public key:
curl -sSfLO https://docs.levelfour.ai/keys/levelfour-k8s-agent.pubVerify the image and the chart:
cosign verify --key levelfour-k8s-agent.pub public.ecr.aws/levelfour/k8s-agent:0.6.1
cosign verify --key levelfour-k8s-agent.pub public.ecr.aws/levelfour/charts/levelfour-agent:0.6.1Verify the SBOM attestation:
cosign verify-attestation --key levelfour-k8s-agent.pub --type spdxjson public.ecr.aws/levelfour/k8s-agent:0.6.1To save the SBOM itself, pipe that command's output through jq -r .payload | base64 -d | jq .predicate > levelfour-agent-0.6.1.spdx.json.
Each command exits with an error when the signature is missing or a different key made it.
Verify the image your nodes run
The version tag points to the multi-arch index, and the SBOM on the tag lists the packages of the amd64 image. Releases after 0.2.0 also sign each architecture's image and attach an SBOM of its own packages, so you can check the exact image an arm64 or amd64 node pulls. List the digests:
docker buildx imagetools inspect public.ecr.aws/levelfour/k8s-agent:<version>Then verify the digest listed for your nodes' platform, linux/arm64 on Graviton:
cosign verify --key levelfour-k8s-agent.pub public.ecr.aws/levelfour/k8s-agent@sha256:<digest>
cosign verify-attestation --key levelfour-k8s-agent.pub --type spdxjson public.ecr.aws/levelfour/k8s-agent@sha256:<digest>Verify the chart in Flux
Flux 2.8 and later verify cosign 3 signatures, so Flux can check the chart on every pull. Put the public key in a Secret next to the OCIRepository. Flux reads every key in that Secret whose name ends in .pub, and the file name gives the key that name:
kubectl -n levelfour create secret generic levelfour-cosign-key \
--from-file=levelfour-k8s-agent.pubThen add verify to the OCIRepository from Install with GitOps. Flux refuses a chart that the LevelFour key did not sign:
spec:
verify:
provider: cosign
secretRef:
name: levelfour-cosign-keyAutomation
The optional component that resizes running pods toward their targets and after OOM kills or throttling, configured with objects in your cluster, and stopped or reverted in one step.
What the agent reads
Every Kubernetes permission the LevelFour agent and its optional netflow component 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.