Kubernetes

Automation

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.

The agent only reads your cluster. Automation is a separate, optional component that changes it, in the namespaces you allow. It installs with the agent's chart, runs with its own service account and permissions, and changes nothing until a configuration object or an admin in the dashboard turns it on.

It does four things:

  • Fixes in place. After OOM kills or sustained CPU throttling, it gives the running container more memory or CPU without restarting it.
  • Rightsizing steps. Where automation is on, it moves each container's requests toward the target LevelFour measured, one step at a time, on the running pods.
  • Keeps the values on new pods. With the webhook on, a rollout or a scale-out starts its pods with the values already reached, with no change to your manifests.
  • Auto-merge. It merges the LevelFour pull requests that fall in a class you opted a namespace into.

Turn automation on

These steps turn on the in-place fixes for OOM kills and CPU throttling in one namespace, and leave its requests where they are. You need the agent installed and reporting, Kubernetes 1.33 or later, and Helm 3.14 or later.

A container that crashes as it starts needs a current kubelet

Before 1.35.9, 1.36.4 and 1.37, the kubelet reports a resize of a container that is not running as done, but does not apply it (kubernetes#138760). On those nodes, a container OOM-killed as it starts keeps crash looping after its raise. A container OOM-killed while it runs gets its raise on any version from 1.33. The Automation tab shows how many of the cluster's nodes run a kubelet without the fix, and how many did not report their version. Update the kubelet has the steps for each platform.

Install the component

List the namespaces the component may change. On its own it changes nothing.

helm upgrade levelfour-agent oci://public.ecr.aws/levelfour/charts/levelfour-agent --version 0.8.6 \
  --namespace levelfour --reset-then-reuse-values \
  --set automation.enabled=true \
  --set 'automation.allowedNamespaces={<namespace>}'

--reset-then-reuse-values keeps the values you set at install and takes the new chart's defaults for everything else.

Turn it on for the namespace

Save this object with the email of the person who approved it:

automation.yaml
apiVersion: levelfour.ai/v1
kind: NamespaceAutomationConfig
metadata:
  name: <namespace>
  namespace: <namespace>
  annotations:
    levelfour.ai/approved-by: <approver@example.com>
spec:
  automation:
    operational:
      restrictions:
        cpuManagement:
          request:
            decreaseEnabled: false
        memoryManagement:
          request:
            decreaseEnabled: false
    workloadTypes:
      Deployment:
        operational:
          automationMode: Enabled

The two decreaseEnabled: false keep the automation from cutting requests. Without them it also takes the rightsizing steps. The object opts the namespace in to recommendations as well. Apply it:

kubectl apply -f automation.yaml

On the cluster's page in LevelFour:

  1. On the Namespaces tab, turn on Recommendations for the namespace.
  2. On the Automation tab, open Guardrails, turn on Automation on this cluster and Save.
  3. Open the namespace in the Automation tab's table and turn on In-place resize.

The namespace's rightsizing mode stays Off, so its requests are never cut.

Check it

kubectl get levelfour -A

An object shows True under READY and Accepted under REASON. On the Automation tab, the component reports and the namespace shows as on.

From then on:

  • After two OOM kills of a container within an hour, or one while it crash loops, its memory limit rises by 25% on the running pod.
  • After LevelFour measures a container throttled at its CPU limit, its CPU limit rises by up to 50% on the running pod.
  • A workload created after the install waits for the agent's next hourly report, so its first fix can take up to an hour.
  • The Automation tab lists each change with its values before and after and what set it off.

When nothing changes

What you seeWhyWhat to do
kubectl apply answers no matches for kind "NamespaceAutomationConfig"The component is not installed, so its objects are not eitherRun the first step
False under READY, NamespaceNotAllowed under REASONThe namespace is not in automation.allowedNamespacesAdd it and run the first step again
False under READY, MissingApproval under REASONlevelfour.ai/approved-by holds no emailAdd the email and apply the object again
On the Automation tab, the namespace says the Helm install leaves it outThe dashboard's version of NamespaceNotAllowedAdd it and run the first step again
Nothing under READY, and the Automation tab says the component is Not reportingThe component is not running, or cannot reach LevelFour. Without LevelFour for five minutes it changes nothingRead kubectl --namespace levelfour logs deploy/levelfour-agent-automation
A container is OOM-killed again after its raise, and the Automation tab says Still out of memoryOne raise was not enough, or the node's kubelet did not apply it (see the warning above)Raise the limit in the manifest, or upgrade the node
With the webhook on, new pods of a rightsized workload start on their manifest values and are resized a moment laterThe control plane cannot reach the webhook on port 9443Open the port, as Install it says

Update the kubelet

The fix is in kubelet 1.35.9, 1.36.4 and every 1.37 (kubernetes#140387, with its backports #141004 and #141003). The VERSION column of kubectl get nodes is each node's kubelet.

Amazon EKS Auto Mode

AWS chooses the node image and replaces Auto Mode nodes on its own: a new image drifts the nodes, at most 10% of them at a time, and no node runs longer than 14 days (Auto Mode instances). AWS does not name the kubelet patch of each image, so check the nodes with kubectl get nodes after the next replacement.

Amazon EKS managed node groups

The first Amazon Linux 2023 EKS-optimized AMI with the fix is 1.35.9-20261019 for 1.35, 1.36.4-20260917 for 1.36 and 1.37.0-20260923 for 1.37 (amazon-eks-ami releases). Update each node group to the latest AMI of its version:

aws eks update-nodegroup-version --cluster-name <cluster> --nodegroup-name <node-group>

In the console, open the cluster's Compute tab, choose Update now in the node group's AMI release version column, keep Rolling update, and choose Update (Update a managed node group). A node group that runs your own AMI from a launch template takes a new launch template version with an AMI built from one of those releases.

Karpenter

An EC2NodeClass whose amiSelectorTerms holds alias: al2023@latest takes each new AMI by itself: Karpenter marks the older nodes as drifted and replaces them, a new node before each old one is removed (Disruption). A pinned alias moves when you change it to a release with the fix, such as al2023@v20261119 (Managing AMIs).

Self-managed nodes on EKS

Read the current AMI for the cluster's version from /aws/service/eks/optimized-ami/<version>/amazon-linux-2023/x86_64/standard/recommended/image_id in Systems Manager, then move the workloads to a node group that runs it (Update self-managed nodes).

Google GKE

The fix is in GKE 1.35.9-gke and later, 1.36.4-gke and later, and every 1.37. On November 23, 2026 the Stable channel offered no fixed 1.35 patch yet, and it has offered 1.36.4-gke since October 27 (GKE release notes). Node auto-upgrade moves Standard node pools by itself. To move a node pool now, upgrade the control plane first if it is older, then the pool (Upgrade a cluster):

gcloud container clusters upgrade <cluster> --node-pool=<node-pool> --location=<location> --cluster-version=<version>

Azure AKS

AKS ships the fix in 1.35.9, 1.36.5 and 1.37.1, from its release of October 25, 2026, rolled out region by region; AKS never shipped 1.36.4 (AKS release 2026-10-25). A node image upgrade keeps the Kubernetes version, so it does not bring the fix. Upgrade the control plane first if it is older, then each node pool (Upgrade node pools):

az aks nodepool upgrade --resource-group <resource-group> --cluster-name <cluster> --name <node-pool> --kubernetes-version <version>

Until the nodes run the fix

A raise reaches a container that crashes as it starts only through the workload's spec. Put the raised memory limit in the spec, in Git or with kubectl set resources, and the rollout that follows starts the new pods with it. A kubectl rollout restart alone starts them on the spec's old values.

Nodes without a kubelet version

The agent sends each node's kubelet version from 0.6.0. Nodes an older agent reports show as not checked: upgrade the agent, or read the versions with kubectl get nodes.

Where it acts

The component acts in a namespace only when all three of these hold:

  1. Your install allows it. The chart value automation.allowedNamespaces lists the namespaces it may touch. The chart grants it permissions in those namespaces and nowhere else, so Kubernetes refuses anything outside the list.
  2. The namespace is opted in to recommendations, with the levelfour.ai/recommendations=enabled label, the switch on the namespace page, or a configuration object. An object that sets automationMode opts in the namespaces it covers: its own for a namespace's or a workload's object, every namespace in automation.allowedNamespaces for a cluster's. A label or the switch that turns a namespace off still wins. Choose namespaces covers the label and the switch.
  3. Automation is turned on for the workload, by a configuration object or by an admin on the cluster's Automation tab.

It never acts in kube-system, kube-public, kube-node-lease or the agent's own namespace, nor in a namespace labelled levelfour.ai/automation: "off". Quote "off", which YAML would otherwise read as false. To keep LevelFour to one cluster and two of its namespaces, install the component on that cluster only and list the two namespaces.

Install it

In-place resize needs Kubernetes 1.33 or later. Add the component to your install:

values.yaml
automation:
  enabled: true
  allowedNamespaces:
    - payments
    - checkout
  webhook:
    enabled: true
  revert:
    allowPodEviction: false
  hardLimits:
    maximumCores: 8
    maximumGiB: 16
helm upgrade levelfour-agent oci://public.ecr.aws/levelfour/charts/levelfour-agent \
  --version 0.8.6 \
  --namespace levelfour --reset-then-reuse-values -f values.yaml

If you turned the component on with chart 0.4.x, follow Upgrading to 0.6.0 or later instead, because reusing your values brings back the old automation keys and the chart refuses them.

ValueDefaultWhat it does
automation.enabledfalseInstalls the component and the configuration objects. On its own it changes nothing
automation.allowedNamespaces[]The namespaces the component may change. Required with automation.enabled: true. ["*"] grants the whole cluster and makes the component watch every pod, so a list is lighter on a big cluster
automation.webhook.enabledfalseGives each new pod of a rightsized workload its values at creation
automation.revert.allowPodEvictionfalseLets a revert evict a pod whose memory limit Kubernetes 1.33 and 1.34 will not lower in place
automation.hardLimits.maximumCores8The most CPU, in cores, the component or the webhook sets on a container, request or limit, whatever an object or the dashboard asks for
automation.hardLimits.maximumGiB16The same ceiling for memory, in GiB

The chart refuses an empty automation.allowedNamespaces, a hard limit that is not positive, and any automation key it does not know. Configure the agent lists the component's own resources and priority class.

The webhook needs port 9443

The control plane must reach the webhook's pods on port 9443. On EKS, allow it from the cluster security group in your nodes' security groups, and for Karpenter in the EC2NodeClass's. Without it, the webhook times out, new pods start as their manifests say, and the component resizes them in place afterwards.

Configure it in the cluster

The chart defines six objects in the levelfour.ai/v1 API group. A team that keeps its configuration in Git applies them with kubectl or Argo CD like any other manifest.

KindScopeWhat it sets
ClusterAutomationConfigClusterWhen the automation may act and how much it may change, for the whole cluster
NamespaceAutomationConfigNamespaceThe same, for one namespace
WorkloadAutomationConfigNamespaceThe same, for one workload and its containers, named by targetRef
ClusterRecommendationsConfigClusterThe sizing policy and the days of history a target reads
NamespaceRecommendationsConfigNamespaceThe same, for one namespace
WorkloadRecommendationsConfigNamespaceThe same, for one workload

kubectl explain clusterautomationconfig.spec --recursive describes every field and its default, and kubectl get levelfour -A lists every object with its status.

A cluster object

The levelfour.ai/approved-by annotation names the person who approved turning automation on, and an object that sets automationMode: Enabled needs it. In this example:

  • stopAllAutomation: true would pause the automation in the whole cluster, and cleanupAllAutomation: true would stop it and put every changed pod back on its spec.
  • duringRolloutInProgress: pause holds new changes on a workload while it rolls out.
  • workloadLabelSelectors leaves out the workloads labelled criticality: tier-0.
  • wasteMaxAutomationFrequency sets the shortest time between two cuts on one workload, and fixResiliencyMaxAutomationFrequency between two raises.
  • maintenanceWindow sets the hours, in UTC, for each weekday. 00:00-00:00 allows no change that day, here Saturday and Sunday. With maintenanceWindowIgnoredMinResiliencyLevel: High, an OOM fix may act outside the window.
  • workloadMinWasteUSDPerMonth: 5 cuts only when the waste passes 5 US dollars a month.
  • maximumCores: -1 sets no maximum of its own, so automation.hardLimits still caps it.
cluster-automation.yaml
apiVersion: levelfour.ai/v1
kind: ClusterAutomationConfig
metadata:
  name: cluster
  annotations:
    levelfour.ai/approved-by: sre@levelfour.ai
spec:
  automation:
    operational:
      stopAllAutomation: false
      cleanupAllAutomation: false
      duringRolloutInProgress: pause
      workloadLabelSelectors:
        - key: criticality
          value: tier-0
          allowAutomation: false
      timeConstraints:
        wasteMaxAutomationFrequency: "30m"
        fixResiliencyMaxAutomationFrequency: "30m"
        maintenanceWindow:
          monday: ["09:00-18:00"]
          tuesday: ["09:00-18:00"]
          wednesday: ["09:00-18:00"]
          thursday: ["09:00-18:00"]
          friday: ["09:00-18:00"]
          saturday: ["00:00-00:00"]
          sunday: ["00:00-00:00"]
        maintenanceWindowIgnoredMinResiliencyLevel: High
      restrictions:
        workloadMinWasteUSDPerMonth: 5
        cpuManagement:
          request:
            increaseEnabled: true
            decreaseEnabled: true
            minimumCores: 0.1
            maximumCores: -1
            cpuRunawayDetection:
              maxCpuRequestIncreaseIterations:
                daily: 3
                weekly: 6
          limit:
            keepLimit: true
        memoryManagement:
          request:
            increaseEnabled: true
            decreaseEnabled: true
            minimumGiB: 0.25
            maximumGiB: -1
          limit:
            increaseEnabled: true
            decreaseEnabled: false
            fastOOMReaction:
              enabled: true
            minimumGiB: -1
            maximumGiB: -1
            memoryLeakDetection:
              maxMemoryIncreaseIterations:
                daily: 3
                weekly: 6
    workloadTypes:
      Deployment:
        operational:
          automationMode: Enabled
      StatefulSet:
        operational:
          automationMode: Enabled
      DaemonSet:
        operational:
          automationMode: Disabled

Automation turns on per kind of workload, under workloadTypes, which takes Deployment, StatefulSet and DaemonSet. Enabled lets the automation change those workloads. Disabled keeps them unchanged, and LevelFour still shows the step it would take. Each kind can also carry its own timeConstraints and restrictions under operational, which override the object's own for that kind.

A namespace object

This one never cuts a memory request in checkout and turns automation on for the namespace's Deployments.

checkout-automation.yaml
apiVersion: levelfour.ai/v1
kind: NamespaceAutomationConfig
metadata:
  name: checkout
  namespace: checkout
  annotations:
    levelfour.ai/approved-by: sre@levelfour.ai
spec:
  automation:
    operational:
      restrictions:
        memoryManagement:
          request:
            decreaseEnabled: false
    workloadTypes:
      Deployment:
        operational:
          automationMode: Enabled

A namespace object takes duringRolloutInProgress, workloadLabelSelectors, timeConstraints, restrictions and workloadTypes. The two kill switches belong to the cluster object only.

A workload object

targetRef.kind takes Deployment, StatefulSet or DaemonSet. Each key under containers names one container and holds its override, here a minimum memory request of 2 GiB for the jvm container.

api-automation.yaml
apiVersion: levelfour.ai/v1
kind: WorkloadAutomationConfig
metadata:
  name: api
  namespace: payments
  annotations:
    levelfour.ai/approved-by: sre@levelfour.ai
spec:
  targetRef:
    kind: Deployment
    name: api
  automation:
    operational:
      automationMode: Enabled
      timeConstraints:
        wasteMaxAutomationFrequency: "4h"
      containers:
        jvm:
          operational:
            restrictions:
              memoryManagement:
                request:
                  minimumGiB: 2

The sizing policy

workloadPolicy takes MaxSavings, Balanced, ExtraHeadroom or MaxHeadroom. cpuPolicy and memoryPolicy set it for CPU or memory alone, and each defaults to workloadPolicy. customTimeWindowDays is how many days of usage a target reads, from 1 to 90. memoryRequestEqualsLimit: true would set the memory limit equal to the new request.

cluster-recommendations.yaml
apiVersion: levelfour.ai/v1
kind: ClusterRecommendationsConfig
metadata:
  name: cluster
spec:
  policies:
    workloadPolicy: Balanced
    cpuPolicy: MaxSavings
    memoryPolicy: Balanced
    customTimeWindowDays: 14
    memoryRequestEqualsLimit: false

NamespaceRecommendationsConfig takes the same policies, and WorkloadRecommendationsConfig adds a targetRef. A container takes no step before LevelFour has customTimeWindowDays of its usage. The component reads these objects too, so they need it installed, and they apply to recommendations whether or not automation is turned on.

Which value wins

The most specific value wins, field by field. In order:

  1. A container's override in its workload object.
  2. The workload object.
  3. The namespace object's settings for the workload's kind, then the namespace object.
  4. The cluster object's settings for the workload's kind, then the cluster object.
  5. A value saved on the Automation tab.
  6. The default.

-1 means none: no minimum, no maximum or no cap. It overrides a wider value, so a namespace can lift a minimum the cluster set. Each weekday of a maintenanceWindow is its own field, so a namespace that names Saturday leaves the cluster's Monday as it was. A field an object sets cannot be changed from the dashboard, and LevelFour refuses the change.

Defaults

Raising is on by default, because a cut is only safe when the automation may raise again after an OOM kill.

FieldDefault
automationModeNot set: the Automation tab decides
stopAllAutomation, cleanupAllAutomationfalse
duringRolloutInProgresspause
wasteMaxAutomationFrequency, fixResiliencyMaxAutomationFrequency30m for a Deployment, 4h for a DaemonSet, 24h for a StatefulSet
maintenanceWindowEvery day, all day
maintenanceWindowIgnoredMinResiliencyLevelNone
workloadMinWasteUSDPerMonth5
request.increaseEnabled, request.decreaseEnabled (CPU and memory)true
memoryManagement.limit.increaseEnabledtrue
memoryManagement.limit.decreaseEnabledfalse
fastOOMReaction.enabledtrue
keepLimittrue
Every minimum* and maximum*-1, capped by automation.hardLimits
daily, weekly raise caps3 and 6
workloadPolicyBalanced
customTimeWindowDays14
memoryRequestEqualsLimitfalse

A few rules sit behind those fields:

  • Windows. A span reads "HH:MM-HH:MM" in UTC and includes both ends. "00:00-00:00" keeps the automation out for the whole day, and a weekday an object leaves out allows the whole day. maintenanceWindowIgnoredMinResiliencyLevel lets a fix act outside the window: an OOM kill counts as High and throttling as Medium. A rightsizing step never leaves the window.
  • Bounds. A move toward a bound always goes ahead. minimumCores and minimumGiB stop a cut or a new request, and maximumCores and maximumGiB stop a raise. The CPU limit follows the CPU request's switches and bounds.
  • CPU limits. The automation never removes a CPU limit, so keepLimit must be true.
  • Guaranteed pods. A Guaranteed pod's memory request equals its limit, so cutting it lowers the limit too. That needs memoryManagement.limit.decreaseEnabled: true, which is off by default, so a Guaranteed pod's memory is not cut until an object turns it on.
  • Rollouts. With pause, a workload in the middle of a rollout takes no new step or raise: live pods from two of a Deployment's ReplicaSets, or a StatefulSet or DaemonSet its controller has not finished updating. A rollback or a revert still runs. continue lets them go ahead.
  • Labels. workloadLabelSelectors from the cluster and namespace objects add up, and the namespace wins on the same key and value. With only allowAutomation: true entries, the automation acts on the workloads that match one. With false entries, it leaves out the ones that match one, even when a workload object turns it on.

Turning it on, and who approved it

automationMode: Enabled, under workloadTypes in a cluster or namespace object or on a workload object, needs the email of the person who approved it in the levelfour.ai/approved-by annotation. Without it the object is not applied.

LevelFour records that email as the approver the object declares, together with the object's kind, namespace, name and generation, the way a commit names its author. Whoever may write the object may write any email there, so the approval itself is the review in your own repository. A change turned on from the dashboard records the admin who turned it on.

What the component made of each object

The component reads every object, sends the ones it accepted to LevelFour every minute, and writes its verdict to each object's Ready condition:

ReasonReadyMeaning
AcceptedTrueLevelFour applies it
ConflictFalseAn older object of the same kind covers the same scope: one per cluster, one per namespace, one per workload. The oldest stands. Delete one of the two
MissingApprovalFalseIt turns automation on without an email in levelfour.ai/approved-by
InvalidWindowFalseA maintenanceWindow span ends before it starts
NamespaceNotAllowedFalseIts namespace is not in automation.allowedNamespaces, so the component cannot act there. Recommendations objects are exempt, since they change no pod
TooManyObjectsFalseIts namespace holds more than 100 workload objects, or the cluster more than 2,000, and this one came after them by name. Cluster and namespace objects always count

The API server checks each object as it is applied, so a misspelled field, a minimum above its maximum, a window written 9:00-18:00 or an interval written 30s never gets in.

The component also holds the accepted objects itself, before it asks LevelFour. It refuses a change on a workload set to Disabled, outside its window, when the resource's increase or decrease is off, or past a minimum or maximum. stopAllAutomation pauses it at once, even when LevelFour cannot be reached, and cleanupAllAutomation reverts it.

Who may write the objects

ObjectsWho
Namespace and workload objects in a namespaceThat namespace's admin role, which the chart extends
Cluster objectsWhoever may write cluster-scoped resources
Reading any of themAnyone with the view role

Whoever may write an object may turn automation on in the namespaces automation.allowedNamespaces lists. The install keeps its own limits above every object: that list, automation.hardLimits, stopAllAutomation in the cluster object, and the levelfour.ai/automation: "off" label on a Namespace.

What it changes

Fixes after OOM kills and throttling

TriggerWhat it raisesWhen
OOM killMemoryTwo OOM kills of the same container within an hour, or one while it crash loops
CPU throttlingCPULevelFour measured the container throttled at its current limit

Each raise adds up to 25% of memory or 50% of CPU, within the objects' maximums and automation.hardLimits, and never past double the workload's own spec. The automation and its webhook never lower a JVM's limits, and never cut the CPU request of a JVM with no CPU limit. A JVM whose heap -Xmx does not fix gets up to four times the step, since its heap may take 75% of the new limit and the room outside it still has to grow by the step. fastOOMReaction.enabled: false turns the memory raise off, and the daily and weekly caps stop raises in a row.

Rightsizing steps

Where automation is on for a workload, LevelFour plans steps toward each container's target, and the component takes them:

  • Size of a step. A cut takes at most 20% of the request at a time, and a raise goes in one step.
  • Pace. The next step waits the workload's interval: wasteMaxAutomationFrequency after a cut, fixResiliencyMaxAutomationFrequency after a raise.
  • How. The component asks LevelFour to approve the step, dry-runs it, then moves every running pod of the workload in place, at most 10 pods a minute. A Burstable pod keeps its limit. A Guaranteed pod's limit moves with its request, which Kubernetes lowers in place only from 1.35.
  • Checking it. Until the interval passes, an OOM kill, an eviction, two restarts within an hour or a pod that stops being ready puts the workload's pods back, with no approval, and reports it. They go back to the most recent value that held through the workload's daily peak, the hour of the day, in UTC, when the container uses the most of that resource. When no step has held through it, they go back to the manifest's value.
  • After a rollback. For 14 days the automation does not cut that resource below the value it went back to. The other resource keeps moving.
  • A workload that cannot create pods, because its ReplicaSet reports ReplicaFailure or its controller logged FailedCreate, drops out of the rightsized values at once.
  • No pull request for the same change. A container the component takes to its target in place gets no request recommendation or pull request for it.

The values reached go to ConfigMaps named levelfour-desired-<namespace>-<n> in the agent's namespace. A pod that starts on its workload's spec gets them in place, and with the webhook on, a new pod gets them at creation. The webhook changes a container only while its values equal the ones LevelFour planned from, so a change to your manifest wins at once.

When your team changes the manifest

Your manifest stays the source of truth. When a deploy changes a container's requests or limits:

  1. The new pods start with the values the manifest sets. The webhook leaves them as they are, and LevelFour approves no step planned from the old values.
  2. Within a day, at LevelFour's daily scan, the container starts over from the new values. The values new pods were given are withdrawn, and the steps it took and any floor a rollback left are cleared.
  3. LevelFour learns the container again for customTimeWindowDays, counted from the change, before it plans the next step. The steps then go as before: a cut of at most 20% at a time, at the workload's interval, inside its window.

A new image with the same requests and limits does not start the container over.

To keep a workload where its manifest puts it, give it a workload object with automationMode: Disabled, and LevelFour keeps showing the steps it would take. To keep only one resource there, set decreaseEnabled: false for it, or a minimumCores or minimumGiB at the manifest's value. To keep a whole namespace out, label it levelfour.ai/automation: "off".

What it leaves alone

  • BestEffort pods, and pods that set resources at the pod level.
  • Init containers that are not sidecars, and containers other tools inject.
  • Jobs and CronJobs, and pods with no Deployment, StatefulSet or DaemonSet behind them.
  • Resources a Vertical Pod Autoscaler writes.
  • A resource whose resizePolicy is RestartContainer.
  • A change that would lower a JVM's limits, cut the CPU request of a JVM with no CPU limit, or go past a LimitRange's bounds. From agent 0.8.1, a JVM the reader measured on a JDK that counts processors from the node (19 and later, 17.0.5 and later, 11.0.17 and later) takes the CPU request cut; its limits still stay. From agent 0.8.2, an image tagged latest or with no tag never takes that cut, since a push can put an older JDK under the same name: the CPU request stays and the activity names why. From agent 0.8.3, the cut holds only on a pod running the exact image build, by digest, whose JDK the reader checked. A pod on another build gets back the CPU request LevelFour set, and a request LevelFour did not set stays as it is. Pin a versioned tag or a digest to lift it. A running JVM keeps the heap and the garbage collector it picked at start, so until LevelFour reads the heap from the running JVM, a lower limit is a guess.

Those changes reach you as recommendations and pull requests instead.

Before every change, the component sends it to Kubernetes as a dry run, so the API server checks it against quotas, LimitRanges and the QoS rules. Then LevelFour approves it against the objects, the switches and the window again. Nothing changes without both. When LevelFour cannot be reached for five minutes, the component writes nothing, reverts included, until it can.

Stop and revert

Two ways stop it, from the cluster or from the dashboard:

  • Pause. stopAllAutomation: true in the cluster object, or Stop all automation on the Automation tab, refuses every new change within a minute. Pods keep the values they have.
  • Stop and revert. cleanupAllAutomation: true, or Stop and revert, also puts every pod the component changed back on its workload's own spec, read from its ReplicaSet, StatefulSet or DaemonSet, and deletes the rightsized values.

An object lifts only the pause or stop it set itself: clearing its switch never undoes a stop a person made on the tab.

On Kubernetes 1.33 and 1.34, a memory limit cannot go back down on a running pod. With automation.revert.allowPodEviction: true the component evicts the pod, so it restarts at its original size. Without it, the pod keeps the larger limit until its next rollout. A revert finishes once every pod is back, left to its next rollout, or left alone, and the component retries a pod whose revert failed, such as an eviction a PodDisruptionBudget refused.

Auto-merge

Auto-merge is set per namespace on the Automation tab, one class at a time. A pull request merges on its own only when every change in it belongs to a class that namespace allows.

ClassValueWhat it covers
Reliability fixesreliability_fixMore memory after OOM kills, or more CPU after throttling, on a resource no VPA manages
Small request cutssmall_request_decreaseRequests cut by 25% or less, with limits untouched, from at least 14 days of data. Guaranteed pods, workloads that an HPA scales on CPU utilization, and containers that regressed recently never qualify
Autoscaler targetsautoscaler_targetAn HPA or KEDA utilization target changed together with its request, keeping the scaling point where it was

Replica counts, idle workloads, NodePools, node groups and volume claims never merge on their own.

LevelFour merges a pull request only when GitHub reports it mergeable with every check on its last commit passed, the base branch requires at least one status check, and the maintenance window is open. Your branch protection still applies. A regression after a merge turns that class off for the namespace and opens the revert pull request. After you merge covers the checks.

Who can do what in the dashboard

ActionWho
Turn automation on for the cluster or a namespace, change a setting no object sets, resume after a stop, allow an auto-merge classAdmins, signed in to the dashboard. API keys and AI assistants cannot
Stop, stop and revert, turn a namespace offAdmins and members
See the settings, the objects and every changeEveryone who can see the cluster

The Automation tab lists every change, stop and setting change with its time, its namespace and workload, the values before and after, and who approved it, as a person in the dashboard or as declared in an object.

Permissions

The component has its own service account, separate from the agent's, and holds no permission to change Deployments, StatefulSets or any other workload.

PartPrivilegeWhy
Role in each allowed namespaceget, list, watch on pods; patch on pods/resize; get, list, watch on ReplicaSets, StatefulSets and DaemonSets; list on eventsTo see OOM kills, resize a running container, read the spec a revert restores, and find a workload that cannot create pods
Same Role, with automation.revert.allowPodEvictioncreate on pods/evictionTo revert a memory limit on Kubernetes 1.33 and 1.34
ClusterRoleget on the kube-system namespace; list on namespacesThe cluster's identity, and the namespaces labelled levelfour.ai/automation: "off"
Same ClusterRoleget, list, watch on the six configuration objects; patch on their statusTo read the configuration and write each object's Ready condition
Roles aggregated to admin and viewWrite on the namespace and workload objects for admin; read on all six for viewSo a namespace's own team manages its configuration
Role in the agent's namespacecreate, get, list, watch, update, delete on ConfigMapsTo write the rightsized values
Webhook Role in the agent's namespaceget, list, watch on ConfigMapsTo read those values
Webhook Role in each allowed namespacelist, watch on LimitRangesTo keep a changed pod within its namespace's LimitRanges
MutatingWebhookConfiguration, with automation.webhook.enabledPod creation in the allowed namespacesTo give new pods the rightsized values

With automation.allowedNamespaces: ["*"], the pod rules and the webhook's LimitRange rule come in ClusterRoles instead. The component talks to api.levelfour.ai on port 443, like the agent, with the same token. The webhook never calls LevelFour or the API server while it admits a pod, and with failurePolicy: Ignore and a 2-second timeout, a pod it cannot answer for starts as its manifest says.

Remove it

Set automation.enabled: false and upgrade the chart, or uninstall it. Either way removes the component, its permissions and the rightsized values.

The configuration objects and their definitions stay, so an uninstall never deletes a team's configuration. To remove them too:

kubectl delete crd -l app.kubernetes.io/part-of=levelfour-k8s

On this page

Ask the FinOps Agent about your cloud spend