Open
Description
Report
With CPU and the http-external-scaler together as triggers in the same scaled object, the http scaler is superseding the CPU scaler.
With CPU under heavy load and with http request(s) it scales up successfully, but KEDA subsequently intervenes and scales to 0 ignoring CPU.
Expected Behavior
Under heavy CPU load even with no http requests KEDA should not scale down to 0.
Actual Behavior
The HTTP add on appears to be overriding the CPU scaler.
Steps to Reproduce the Problem
- Create an nginx or other deployment paired with a CPU load test side car or init container. The memory scaler behaves similarly.
- Send an http request and watch as it initially scales up then scales back down to 0.
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: my-namespace
spec:
selector:
app: my-app
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 80
name: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
namespace: my-namespace
spec:
replicas: 0
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: nginx
ports:
- containerPort: 80
resources:
requests:
cpu: "100m"
memory: "100Mi"
limits:
cpu: "500m"
memory: "100Mi"
- name: stress-ng
image: polinux/stress-ng:latest
command: ["/bin/sh", "-c"]
args:
- "echo 'Running stress-ng'; stress-ng --cpu 1 --vm 1 --vm-bytes 64M --timeout 300s; echo 'stress-ng finished'; sleep 3600"
resources:
requests:
cpu: "100m"
memory: "100Mi"
limits:
cpu: "1000m"
memory: "1000Mi"
---
kind: ScaledObject
apiVersion: keda.sh/v1alpha1
metadata:
name: my-scaled-object
namespace: my-namespace
spec:
initialCooldownPeriod: 120
cooldownPeriod: 30
minReplicaCount: 0
maxReplicaCount: 4
pollingInterval: 5
fallback:
failureThreshold: 5
replicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-deployment
advanced:
horizontalPodAutoscalerConfig:
name: custom-hpa-name
behavior:
scaleDown:
stabilizationWindowSeconds: 300
triggers:
- type: cpu
name: cpu_trig
metricType: Utilization
metadata:
value: "10"
- type: external
name: http_trig
metadata:
httpScaledObject: my-scaled-object
hosts: "myhost"
scalerAddress: keda-add-ons-http-external-scaler.keda:9090
---
kind: HTTPScaledObject
apiVersion: http.keda.sh/v1alpha1
metadata:
name: my-scaled-object
namespace: my-namespace
annotations:
httpscaledobject.keda.sh/skip-scaledobject-creation: "true"
spec:
hosts:
- "myhost"
scalingMetric:
requestRate:
granularity: 1s
targetValue: 2
window: 1m
scaledownPeriod: 300
scaleTargetRef:
name: my-deployment
service: my-service
port: 80
replicas:
min: 0
max: 4
targetPendingRequests: 1
---
kind: Service
apiVersion: v1
metadata:
name: keda-add-ons-http-interceptor-proxy
namespace: my-namespace
spec:
type: ExternalName
externalName: keda-add-ons-http-interceptor-proxy.keda.svc.cluster.local
Logs from KEDA HTTP operator
No response
HTTP Add-on Version
0.10.0
Kubernetes Version
None
Platform
Any
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
To Triage