I have a deployment.yaml of application with CPU and memory specified as :
resources:
requests:
memory: "10Gi"
ephemeral-storage: 2Gi
cpu: 50m
limits:
memory: "12Gi"
ephemeral-storage: 5Gi
cpu: 5
The KEDA scaling is defined as follows :
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: keda-scaler
labels:
app.kubernetes.io/name: app123
infra.arc/repo.managed: kubernetes
spec:
scaleTargetRef:
name: app123
cooldownPeriod: 60
minReplicaCount: 2
maxReplicaCount: 5
advanced:
restoreToOriginalReplicaCount: true
fallback: # Fallback strategy when metrics are unavailable for the apps
failureThreshold: 3
replicas: 2 #Keep this desired state when metrics are unavailable.
triggers:
- type: cpu
metadata:
type: Utilization
value: "80"
What the behavior is happening as soon i start the deployment it automaticaly scales to maxReplica
As per KEDA docs https://keda.sh/docs/2.7/scalers/cpu/
When using Utilization, the target value is the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. When using AverageValue, the target value is the target value of the average of the metric across all relevant pods (quantity).
I could not get in this case i have set the value as 80% but still its scaling too early to max replicas.
Can anyone please suggest what is true meaning of value and metric type with respect to cpu and memory limits we give in deployment.yaml
The value from your example is CPU usage (1 CPU core = 1000m). For example this my ScaledObject for ingres
Important: This scaller is not working if deployment do not have limits and requests params.