In part 1, we explored why one resource request cannot fit every pod of a DaemonSet. Usage can differ across nodes, leaving capacity reserved but unused on quiet nodes and too little requested on busy ones. Some of our largest customers asked us to find a solution.
We tested percentage-based sizing, derived scaling functions and various node groupings against production usage from 92 clusters. Instance type was the strongest grouping among the one-dimensional choices, but no grouping worked best for every DaemonSet, which is why we built scoped recommendations: configurable groups defined by a node label, each sized from its own observed usage.
Today, weโre happy to release scoped DaemonSet rightsizing for general availability. This article is a practical implementation guide to configuring the scope, understanding how recommendations reach pods and inform node provisioning, and validating the results before enabling automation.
Configuring the scope
The scope is selected in the scaling policy. The first exposed preset is Instance type, which resolves to the standard node label node.kubernetes.io/instance-type. It defines groups without percentages, size tiers or boundaries to maintain.

The scope can also be set directly on the workload through its configuration annotation, which takes precedence over the policy:
metadata:
annotations:
workloads.cast.ai/configuration: |
vertical:
scope:
preset: InstanceTypeInstead of the preset, the annotation accepts a custom node-label key:
vertical:
scope:
nodeLabel:
key: custom-labelSet exactly one of preset or nodeLabel.key. A custom label must be present when the node is provisioned; node autoscaling cannot bin-pack candidate nodes against a label that appears only at runtime.
Instance type is the starting preset, not a restriction built into the algorithm. The backend resolves a node-label key and partitions by its values, so the same mechanism supports other labels. The important point is that the grouping is configuration rather than a rule inferred per workload. In this release the exposed preset is instance type.
Per-group usage history starts when scope is enabled. Each group’s recommendation uses the same per-container pipeline as the flat recommendation, over only that group’s pods. Groups with insufficient data or confidence or whose generation fails are omitted, while the unscoped, workload-level recommendation remains valid. Above 100 distinct scope values the recommendation degrades to flat instead of producing an unbounded number of groups. This also means the experiment has to run with scoping enabled before its groups can accumulate history.
What the produced groups look like
Take the OpenTelemetry Collector from the previous chapter. Its scaling policy selects the instance-type preset. Its Recommendation custom resource currently contains a flat request followed by 26 groups. A sample of the Custom Resource is showed below, with limits omitted for brevity:
spec:
recommendation:
- containerName: opentelemetry-collector
requests:
cpu: "37m"
memory: "2323Mi"
scope:
type: NODE_LABEL
key: node.kubernetes.io/instance-type
groups:
- value: c2-standard-4
recommendation:
- containerName: opentelemetry-collector
requests:
cpu: "30m"
memory: "2323Mi"
- value: c2d-highcpu-4
recommendation:
- containerName: opentelemetry-collector
requests:
cpu: "13m"
memory: "111Mi"
The same object also gives 553m CPU to c2d-standard-112 and 609m to c3d-highmem-90. One unscoped recommendation hides all three cases: the quiet group needs only 111 MiB, the group that determines the memory peak needs 2323 MiB and the busiest collectors need more than half a core despite an unscoped request of 37m. These values are computed from the usage on each kind of node; nobody supplied them per group.
How the right group reaches a pod
A DaemonSet pod already has its node assigned when it reaches admission. The workload autoscaler’s mutating webhook reads that node, looks up the scope label and selects the matching group’s requests and limits. If the node does not carry the label or the group is absent, the webhook uses the unscoped recommendation.
The existing safety rules still apply: the limits policy determines the limits, requests are clamped to them and the namespace’s LimitRange constraints are enforced. OOM events and memory escalation are tracked per container and scope value, so an OOM on one instance type affects that group without inflating the others.
DaemonSet pods are not resized in place. New values apply when a pod is recreated, during a restart, rollout or node replacement, and a pod that moves to a different instance type picks up the new node’s group at that admission.
There is one more consumer of the same groups. When Cast AI’s node autoscaler evaluates candidate nodes, it resolves each DaemonSet’s requests from the candidate’s labels as well. Provisioning therefore accounts for the per-instance-type overhead instead of assuming the unscoped request for every candidate. Thus, bin packing works with the requests the pods will actually get. This is where the sizing pays off in cost: the request of each DaemonSet fits the kind of node it runs on, so less capacity is reserved for DaemonSets that do not use it and more is left for the workloads, minimizing the waste.
Why instance type first
Instance type is already attached to the node and its value is normally available by the time a pod is admitted. It needs no inferred classification or custom size boundaries and, unlike a hostname, it survives node replacement, so groups retain history across churn. Its cardinality is also low compared to a hostname: a fleet has a handful of instance types but one hostname per node, so every group collects the pods of many nodes and has enough data for a reliable recommendation. It was also the best single grouping in the validation.
That does not make it the right grouping for every DaemonSet. The important design choice is that the key is configurable, not that instance type is universally correct.
There is also a limit to what any grouping can do. Nodes of the same instance type can host very different amounts of work and those pods share the group’s request. Density and workload behavior are measured through each group’s usage rather than modeled explicitly, but residual variation inside a group remains. The group’s percentile and headroom therefore still matter; what changes is the population over which they are computed.
Is scoping right for your DaemonSets?
A DaemonSet is a candidate when its resource usage differs between kinds of nodes and a stable node label separates those kinds. Log shippers, networking agents and telemetry collectors often match that pattern, while a node exporter or a spot interruption handler usually does not. The way to decide is to compare the unscoped recommendation with the recommendation of each group, as described at the end of this section. A DaemonSet whose pods use roughly the same resources on every node gains nothing from more groups.
Limitations
- A group is not an individual pod. Nodes with the same label share a request even when their density and workloads differ, so the busiest pods in a group still set its headroom. Grouping narrows that population but does not remove it. A scope that is too broad leaves most of the variation inside its groups and one that is too fine leaves too little data in each group.
- History and confidence take time. Per-group metrics start when the scope is enabled and are aggregated within one cluster. A new group uses the unscoped recommendation until it has enough history and confidence and a group that loses confidence falls back to it. At most 100 distinct scope values are supported and beyond that the result is the unscoped recommendation. Groups help where enough usage accumulates in each one, which depends on how many pods share a value and not on how many different values a cluster has.
- The settings remain workload-level. Percentiles, resource constraints, limits and look-back periods apply to every group. There is no separate percentile or limit for one instance type. If a workload still needs an operational floor or ceiling, the existing constraints enforce it. If its values must stay fixed regardless of measured behavior, it is better left static or in read-only mode.
- Scope and eligibility are bounded. This implementation supports DaemonSets only. JVM optimization and HPA-eligible workloads stay outside scoped recommendations. Only the instance-type preset is available through scaling policies and their API or Terraform representation, while custom node labels go through the workload annotation.
- Changes apply when pods are recreated. DaemonSet pods are never resized in place and are not evicted automatically, so new requests take effect on restart, rollout or node replacement. A request therefore does not follow changes in density or workload behavior on a running node until its pod is recreated. A newly formed group appears on the next recommendation cycle.
- The grouping is only as reliable as the label. Missing labels, containers without group metrics and low-confidence groups all resolve to the unscoped recommendation. A custom label must be present when the node is provisioned, because labels applied only at runtime are unavailable to the node autoscaler when it simulates candidate nodes. The instance-type preset does not have that limitation, since cloud-registered nodes already carry the label.
A practical rule for adoption
Check one DaemonSet at a time. Enable its scope in read-only mode so groups and history can accumulate, then compare the unscoped recommendation with each group. Keep the scope when the grouped requests differ in a pattern that the agent’s work explains. Give the scoped history time to fill before you compare. Enabling a scope starts a new per-group history: samples collected before the scope existed are not reused and each group’s confidence is measured against the workload’s full lookback period, so a group only shows up once enough scoped samples have accumulated to clear the policy’s confidence threshold. Validate a complete traffic cycle and watch OOM kills, throttling and error rates before enabling automation on a subset. If the groups look alike or the agent’s load is dominated by bursts that a few samples cannot safely represent, keep the unscoped recommendation. Scoped recommendations show you which DaemonSets benefit from grouping, so you can apply it where it pays off and leave the rest unscoped.
Conclusion
A DaemonSet often does a different amount of work on different nodes while its pod template can express only one request. That request is a compromise, too large on the quiet nodes or too small on the busy ones. Moreover, a request that is right today drifts as workloads and node types change.
We tested whether a property of the node could close that gap. Among the DaemonSets we measured, 57% varied little enough for one request to fit. For the rest, grouping by instance type reduced the relative MAE by 29% for CPU and 25% for memory for the median DaemonSet, but no single grouping was best for every DaemonSet. That is why scoped recommendations let a node label define the groups and compute the request of each group from the usage measured in it.
The DaemonSet stays one workload while its pods get a request that follows the kind of node they run on. The values are recomputed continuously from the usage in each group and the node autoscaler packs and provisions nodes with the same groups, so the capacity it reserves matches what the pods will actually get. From experiments within our own production clusters, scoping dramatically narrows the compromise but does not completely remove it in all situations, since nodes of the same kind can still host very different workloads.
To see whether it helps, pick one DaemonSet whose usage varies across nodes and enable its scope in read-only mode. After a full traffic cycle compare the unscoped recommendation with the groups, keep in mind that enough data needs to accumulate depending on your confidence threshold. If they look alike keep it unscoped and if they differ enable it on a subset of nodes.
Every pod should reserve what it needs on its own kind of node, and that number should come from what it actually uses there.
Already with Cast AI? check out the docs for more implementation tips.
New to Cast AI? Contact us to start your free trial.
References
- YouTube: discussion of the per-node VPA proposal: background on the approach to rightsize DaemonSet pods by node.
- Kubernetes Autoscaler issue #5928: the original upstream request for per-node resource sizing on DaemonSets.
- Vertical Pod Autoscaling for DaemonSets with Heterogeneous Resource Requirements (AEP-7942): the upstream proposal for DaemonSets with Heterogeneous Resource Requirements.
- Danielle Navarro, Learning Statistics with R, section 16.6: ANOVA as a linear model, LibreTexts. Background for analyzing between-group variance and bucketed R-squared.



