Skip to content

PodResourceAutoscaler API reference

Choose exactly one target or selector and define the managed container/resource sides. Set bounds appropriate to the workload. CPU and memory resizing require supported Kubernetes resize behavior, feasible node capacity and permissions; status/events distinguish a decision from successful application.

Group: keda.kedify.io. Kind: PodResourceAutoscaler. Scope: Namespaced.

Defaults below are schema defaults only. “Not specified” does not imply a controller default of zero or false. Required fields are required within their containing object. Runtime behavior can impose additional conditions described in the capability guide.

Served: true; storage: true.

FieldTypeRequiredSchema defaultMeaning and validation
specobjectNoNot specifiedPodResourceAutoscalerSpec defines the desired state of PodResourceAutoscaler x-kubernetes-validations: [{“message”:“PodResourceAutoscaler must have either a pod selector or target specified”,“rule”:“has(self.target) != has(self.selector)”},{“message”:“Specify at least one of policy.cpu.requests, policy.cpu.limits, policy.memory.requests, policy.memory.limits”,“rule”:“(has(self.policy.cpu) && (has(self.policy.cpu.requests) || has(self.policy.cpu.limits))) || (has(self.policy.memory) && (has(self.policy.memory.requests) || has(self.policy.memory.limits)))”}]
spec.boundsobjectNoNot specifiedBounds defines optional bounds and step constraints for request/limit scaling
spec.bounds.cpuobjectNoNot specifiedCPU defines bounds/steps for CPU requests and limits. x-kubernetes-validations: [{“message”:“Specify requests and/or limits bounds”,“rule”:“has(self.requests) || has(self.limits)”}]
spec.bounds.cpu.limitsobjectNoNot specifiedLimits defines optional bounds/steps for limits. If omitted, scaling for this side has no extra bounds from this section.
spec.bounds.cpu.limits.maxinteger or stringNoNot specifiedMax defines maximum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.limits.mininteger or stringNoNot specifiedMin defines minimum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.limits.stepinteger or stringNoNot specifiedStep defines maximum absolute change per resize pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.limits.stepPercentintegerNoNot specifiedStepPercent defines maximum percent change per resize (of current value) minimum: 1; maximum: 100
spec.bounds.cpu.requestsobjectNoNot specifiedRequests defines optional bounds/steps for requests. If omitted, scaling for this side has no extra bounds from this section.
spec.bounds.cpu.requests.maxinteger or stringNoNot specifiedMax defines maximum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.requests.mininteger or stringNoNot specifiedMin defines minimum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.requests.stepinteger or stringNoNot specifiedStep defines maximum absolute change per resize pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.cpu.requests.stepPercentintegerNoNot specifiedStepPercent defines maximum percent change per resize (of current value) minimum: 1; maximum: 100
spec.bounds.memoryobjectNoNot specifiedMemory defines bounds/steps for memory requests and limits. x-kubernetes-validations: [{“message”:“Specify requests and/or limits bounds”,“rule”:“has(self.requests) || has(self.limits)”}]
spec.bounds.memory.limitsobjectNoNot specifiedLimits defines optional bounds/steps for limits. If omitted, scaling for this side has no extra bounds from this section.
spec.bounds.memory.limits.maxinteger or stringNoNot specifiedMax defines maximum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.limits.mininteger or stringNoNot specifiedMin defines minimum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.limits.stepinteger or stringNoNot specifiedStep defines maximum absolute change per resize pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.limits.stepPercentintegerNoNot specifiedStepPercent defines maximum percent change per resize (of current value) minimum: 1; maximum: 100
spec.bounds.memory.requestsobjectNoNot specifiedRequests defines optional bounds/steps for requests. If omitted, scaling for this side has no extra bounds from this section.
spec.bounds.memory.requests.maxinteger or stringNoNot specifiedMax defines maximum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.requests.mininteger or stringNoNot specifiedMin defines minimum allowed value for the resource pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.requests.stepinteger or stringNoNot specifiedStep defines maximum absolute change per resize pattern: ”^(\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9])?)|(\.[0-9]+))))?$”
spec.bounds.memory.requests.stepPercentintegerNoNot specifiedStepPercent defines maximum percent change per resize (of current value) minimum: 1; maximum: 100
spec.containerNamestringYesNot specifiedContainerName what container in the pod should be updated minLength: 1
spec.pausedbooleanNofalsePaused if set to true, can make the controller ignore this CR
spec.policyobjectYesNot specifiedPolicy defines how usage is evaluated and when scaling occurs
spec.policy.afterstringNo"containerReady"After specifies the pod/container state required before a resize is applied enum: [“running”,“containerReady”,“podReady”]
spec.policy.consecutiveSamplesintegerYesNot specifiedConsecutiveSamples is the number of consecutive samples that must breach a threshold minimum: 1
spec.policy.cooldownstringYesNot specifiedCooldown is the minimum time between resize actions for a pod example values: 1m, 2m30s, 5m minLength: 1
spec.policy.cpuobjectNoNot specifiedCPU defines thresholds and target utilization for CPU x-kubernetes-validations: [{“message”:“Specify requests and/or limits policy”,“rule”:“has(self.requests) || has(self.limits)”}]
spec.policy.cpu.limitsobjectNoNot specifiedLimits defines utilization policy against container resource limits. If omitted, PRA does not scale this resource’s limits side. x-kubernetes-validations: [{“message”:“scaleUpThreshold must be greater than scaleDownThreshold”,“rule”:“self.scaleUpThreshold > self.scaleDownThreshold”},{“message”:“consecutiveSamples override must be >= 1”,“rule”:“!has(self.consecutiveSamples) || self.consecutiveSamples >= 1”}]
spec.policy.cpu.limits.consecutiveSamplesintegerNoNot specifiedConsecutiveSamples optionally overrides policy.consecutiveSamples for this resource
spec.policy.cpu.limits.cooldownstringNoNot specifiedCooldown optionally overrides policy.cooldown for this resource example values: 30s, 1m, 2m30s minLength: 1
spec.policy.cpu.limits.scaleDownThresholdintegerYesNot specifiedScaleDownThreshold triggers scale-down if utilization is <= this value (percent) minimum: 0; maximum: 100
spec.policy.cpu.limits.scaleUpThresholdintegerYesNot specifiedScaleUpThreshold triggers scale-up if utilization is >= this value (percent) minimum: 1; maximum: 100
spec.policy.cpu.limits.targetUtilizationintegerYesNot specifiedTargetUtilization is the desired utilization after resize (percent) minimum: 1; maximum: 100
spec.policy.cpu.requestsobjectNoNot specifiedRequests defines utilization policy against container resource requests. If omitted, PRA does not scale this resource’s requests side. x-kubernetes-validations: [{“message”:“scaleUpThreshold must be greater than scaleDownThreshold”,“rule”:“self.scaleUpThreshold > self.scaleDownThreshold”},{“message”:“consecutiveSamples override must be >= 1”,“rule”:“!has(self.consecutiveSamples) || self.consecutiveSamples >= 1”}]
spec.policy.cpu.requests.consecutiveSamplesintegerNoNot specifiedConsecutiveSamples optionally overrides policy.consecutiveSamples for this resource
spec.policy.cpu.requests.cooldownstringNoNot specifiedCooldown optionally overrides policy.cooldown for this resource example values: 30s, 1m, 2m30s minLength: 1
spec.policy.cpu.requests.scaleDownThresholdintegerYesNot specifiedScaleDownThreshold triggers scale-down if utilization is <= this value (percent) minimum: 0; maximum: 100
spec.policy.cpu.requests.scaleUpThresholdintegerYesNot specifiedScaleUpThreshold triggers scale-up if utilization is >= this value (percent) minimum: 1; maximum: 100
spec.policy.cpu.requests.targetUtilizationintegerYesNot specifiedTargetUtilization is the desired utilization after resize (percent) minimum: 1; maximum: 100
spec.policy.delaystringNo"15s"Delay is the wait duration after after becomes true before a resize is applied example values: 15s, 30s, 1m, 2m30s minLength: 1
spec.policy.memoryobjectNoNot specifiedMemory defines thresholds and target utilization for memory x-kubernetes-validations: [{“message”:“Specify requests and/or limits policy”,“rule”:“has(self.requests) || has(self.limits)”}]
spec.policy.memory.limitsobjectNoNot specifiedLimits defines utilization policy against container resource limits. If omitted, PRA does not scale this resource’s limits side. x-kubernetes-validations: [{“message”:“scaleUpThreshold must be greater than scaleDownThreshold”,“rule”:“self.scaleUpThreshold > self.scaleDownThreshold”},{“message”:“consecutiveSamples override must be >= 1”,“rule”:“!has(self.consecutiveSamples) || self.consecutiveSamples >= 1”}]
spec.policy.memory.limits.consecutiveSamplesintegerNoNot specifiedConsecutiveSamples optionally overrides policy.consecutiveSamples for this resource
spec.policy.memory.limits.cooldownstringNoNot specifiedCooldown optionally overrides policy.cooldown for this resource example values: 30s, 1m, 2m30s minLength: 1
spec.policy.memory.limits.scaleDownThresholdintegerYesNot specifiedScaleDownThreshold triggers scale-down if utilization is <= this value (percent) minimum: 0; maximum: 100
spec.policy.memory.limits.scaleUpThresholdintegerYesNot specifiedScaleUpThreshold triggers scale-up if utilization is >= this value (percent) minimum: 1; maximum: 100
spec.policy.memory.limits.targetUtilizationintegerYesNot specifiedTargetUtilization is the desired utilization after resize (percent) minimum: 1; maximum: 100
spec.policy.memory.requestsobjectNoNot specifiedRequests defines utilization policy against container resource requests. If omitted, PRA does not scale this resource’s requests side. x-kubernetes-validations: [{“message”:“scaleUpThreshold must be greater than scaleDownThreshold”,“rule”:“self.scaleUpThreshold > self.scaleDownThreshold”},{“message”:“consecutiveSamples override must be >= 1”,“rule”:“!has(self.consecutiveSamples) || self.consecutiveSamples >= 1”}]
spec.policy.memory.requests.consecutiveSamplesintegerNoNot specifiedConsecutiveSamples optionally overrides policy.consecutiveSamples for this resource
spec.policy.memory.requests.cooldownstringNoNot specifiedCooldown optionally overrides policy.cooldown for this resource example values: 30s, 1m, 2m30s minLength: 1
spec.policy.memory.requests.scaleDownThresholdintegerYesNot specifiedScaleDownThreshold triggers scale-down if utilization is <= this value (percent) minimum: 0; maximum: 100
spec.policy.memory.requests.scaleUpThresholdintegerYesNot specifiedScaleUpThreshold triggers scale-up if utilization is >= this value (percent) minimum: 1; maximum: 100
spec.policy.memory.requests.targetUtilizationintegerYesNot specifiedTargetUtilization is the desired utilization after resize (percent) minimum: 1; maximum: 100
spec.policy.pollIntervalstringYesNot specifiedPollInterval is how often kubelet stats are polled per node example values: 5s, 10s, 30s, 1m minLength: 1
spec.priorityintegerNo0Priority in case multiple (unpaused) PodResourceAutoscaler CRs matches, only the one with the highest priority will be applied. If not specified, it is 0 and if multiple PodResourceAutoscaler with the same priority matches the pod’s label selector, then the next one that’s closest to now() is chosen. Again if multiple match, then lexicographically smaller is picked (CR name).
spec.selectorobjectNoNot specifiedSelector is the general label selector spec that identifies one or multiple Pods if selector is specified, don’t use the target
spec.selector.matchExpressionsarrayNoNot specifiedmatchExpressions is a list of label selector requirements. The requirements are ANDed.
spec.selector.matchExpressions[]objectNoNot specifiedA label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
spec.selector.matchExpressions[].keystringYesNot specifiedkey is the label key that the selector applies to.
spec.selector.matchExpressions[].operatorstringYesNot specifiedoperator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
spec.selector.matchExpressions[].valuesarrayNoNot specifiedvalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
spec.selector.matchExpressions[].values[]stringNoNot specified
spec.selector.matchLabelsobjectNoNot specifiedmatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is “key”, the operator is “In”, and the values array contains only “value”. The requirements are ANDed.
spec.selector.matchLabels.*stringNoNot specified
spec.targetobjectNoNot specifiedTarget is the reference to a workload whose pods should be modified if target is specified, don’t use the selector
spec.target.kindstringYesNot specifiedKind specifies the target workload whose containers will be obtaining the resource updates The ‘rollout’ kind refers to an Argo Rollout in argoproj.io/v1alpha1. enum: [“deployment”,“daemonset”,“statefulset”,“rollout”]
spec.target.namestringYesNot specifiedminLength: 1
FieldTypeRequiredSchema defaultMeaning and validation
statusobjectNoNot specifiedPodResourceAutoscalerStatus defines the observed state of PodResourceAutoscaler
status.conditionsarrayNoNot specified
status.conditions[]objectNoNot specifiedCondition contains details for one aspect of the current state of this API Resource.
status.conditions[].lastTransitionTimestringYesNot specifiedlastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
status.conditions[].messagestringYesNot specifiedmessage is a human readable message indicating details about the transition. This may be an empty string. maxLength: 32768
status.conditions[].observedGenerationintegerNoNot specifiedobservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. minimum: 0
status.conditions[].reasonstringYesNot specifiedreason contains a programmatic identifier indicating the reason for the condition’s last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. minLength: 1; maxLength: 1024; pattern: ”^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$”
status.conditions[].statusstringYesNot specifiedstatus of the condition, one of True, False, Unknown. enum: [“True”,“False”,“Unknown”]
status.conditions[].typestringYesNot specifiedtype of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316; pattern: ”^([a-z0-9]([-a-z0-9][a-z0-9])?(\.[a-z0-9]([-a-z0-9][a-z0-9])?)/)?(([A-Za-z0-9][-A-Za-z0-9_.])?[A-Za-z0-9])$”
status.effectiveSelectorobjectNoNot specifiedA label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
status.effectiveSelector.matchExpressionsarrayNoNot specifiedmatchExpressions is a list of label selector requirements. The requirements are ANDed.
status.effectiveSelector.matchExpressions[]objectNoNot specifiedA label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
status.effectiveSelector.matchExpressions[].keystringYesNot specifiedkey is the label key that the selector applies to.
status.effectiveSelector.matchExpressions[].operatorstringYesNot specifiedoperator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
status.effectiveSelector.matchExpressions[].valuesarrayNoNot specifiedvalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
status.effectiveSelector.matchExpressions[].values[]stringNoNot specified
status.effectiveSelector.matchLabelsobjectNoNot specifiedmatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is “key”, the operator is “In”, and the values array contains only “value”. The requirements are ANDed.
status.effectiveSelector.matchLabels.*stringNoNot specified
status.lastScaleActionstringNoNot specified
status.lastScaleResourceChangestringNoNot specifiedLastScaleResourceChange summarizes request/limit changes from the last scale action.
status.lastScaleTimestringNoNot specified
status.observedGenerationintegerNoNot specified
status.scalingbooleanNoNot specified
Terminal window
kubectl get crd podresourceautoscalers.keda.kedify.io -o yaml
kubectl explain podresourceautoscaler.spec --recursive

Compare served/storage versions and schema before applying configuration. Inspect the resource’s status and events after changing its owning source; schema acceptance alone does not prove successful reconciliation.

CRD-level validation enforces:

  • XOR target / selector
  • at least one side among cpu.requests|cpu.limits|memory.requests|memory.limits
  • scaleUpThreshold > scaleDownThreshold
  • percent range checks (thresholds and stepPercent)
  • consecutiveSamples >= 1
  • bounds supports only cpu and memory keys

Runtime validation/guards include:

  • parseable pollInterval, cooldown, and delay (if set)
  • after must be one of running|containerReady|podReady
  • selected container exists
  • baseline resources exist and are non-zero for configured sides
  • counter resets / missing samples are handled (skipped)

.spec.bounds is optional. If bounds are omitted for a managed side, scaling still works without extra clamping or step caps.

Bounds are configured per resource and per side:

  • bounds.cpu.requests / bounds.cpu.limits
  • bounds.memory.requests / bounds.memory.limits

Each side supports:

  • min
  • max
  • step (absolute max delta per action)
  • stepPercent (relative max delta per action)

If both step and stepPercent are set, the smaller cap is applied.

Top-level policy fields:

  • pollInterval: per-pod evaluation interval (node poll interval becomes the minimum interval among tracked pods on a node).
  • consecutiveSamples: required, must be >= 1
  • cooldown: required duration (minimum time between resize actions for the pod)
  • after: optional apply gate, one of running|containerReady|podReady (default containerReady)
  • delay: optional duration before apply (default 15s)

Resource policies are optional and can be configured per resource and per “side”:

  • policy.cpu.requests / policy.cpu.limits
  • policy.memory.requests / policy.memory.limits

Each utilization policy includes:

  • scaleUpThreshold (percent)
  • scaleDownThreshold (percent)
  • targetUtilization (percent)
  • consecutiveSamples (optional override)
  • cooldown (optional override)

Notes:

  • If you specify policy.cpu, you must configure requests and/or limits under it.
  • If you specify policy.memory, you must configure requests and/or limits under it.
  • scaleUpThreshold must be greater than scaleDownThreshold.

At least one of policy.cpu.requests|policy.cpu.limits|policy.memory.requests|policy.memory.limits must be set.

  • CPU usage is derived from kubelet cumulative counters (rate over time). Memory usage is derived from kubelet working set bytes.
  • For each configured side, utilization is computed as usage / baseline * 100, where the baseline is the container’s request or limit for that side.
  • Utilization is evaluated independently for each configured side.
  • Scale up if any configured side requests scale up.
  • Scale down only if no side requests scale up and at least one side requests scale down.
  • Desired values are computed from targetUtilization and current usage (separately per side), using desired = usage / (targetUtilization / 100).
  • requests <= limits is always enforced.
  • Resize apply is gated by after and delay, and skipped while a pod resize is pending/in progress.

Additional details:

  • CPU needs an initial warm-up sample before a first rate can be computed.

  • Threshold checks are inclusive (>= for up, <= for down).

  • CPU cores used are computed as:

    cores_used = ((cpu_ns_now - cpu_ns_prev) / 1e9) / dt_seconds

You can target pods in two mutually exclusive ways:

  • .spec.selector
  • .spec.target

Exactly one of these must be set.

Allowed target kinds:

  • deployment
  • statefulset
  • daemonset
  • rollout (Argo Rollouts need to be enabled)

When using .spec.selector, the selector uses the same shape as deployment.spec.selector.

If multiple PRAs match the same pod, the winner selection is deterministic:

  • highest priority, then earliest next-eligible time, then lexicographic PRA name

At a high level, a PRA describes:

  • which pods to manage (.spec.selector or .spec.target)
  • which container to resize (.spec.containerName)
  • how to evaluate and apply resize actions (.spec.policy)
  • optional bounds/step caps (.spec.bounds)

You must specify exactly one of .spec.selector or .spec.target.

  • paused: optional bool (default false)
  • priority: optional int (default 0)
  • target: optional workload reference (XOR with selector)
  • selector: optional label selector (XOR with target)
  • containerName: required string; the single container per pod to resize
  • policy: required; evaluation and sizing rules
  • bounds: optional; per-resource bounds and step caps for requests and/or limits
  • conditions: Ready, Active, Scaling, Metrics
  • observedGeneration
  • effectiveSelector
  • lastScaleTime
  • lastScaleAction: scaleUp|scaleDown
  • lastScaleResourceChange: compact before/after delta from the last scale action
  • scaling: boolean derived from lastScaleTime + cooldown window (cleared after cooldown elapses by periodic runtime sync)