Add keda: Spring Boot 4.2.0 Kafka consumers under KEDA autoscaling (partition cap, lag maths, rebalances, SIGTERM vs SIGKILL)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# NOT EXECUTED: see deployment.yaml. Field names and defaults were taken from the KEDA 2.21
|
||||
# documentation (ScaledObject specification and the Apache Kafka scaler page).
|
||||
apiVersion: keda.sh/v1alpha1
|
||||
kind: ScaledObject
|
||||
metadata:
|
||||
name: orders-consumer
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
name: orders-consumer
|
||||
pollingInterval: 15 # seconds between scaler checks when scaling from/to zero (default 30)
|
||||
cooldownPeriod: 120 # only delays scale-to-ZERO after the last active trigger (default 300)
|
||||
minReplicaCount: 1 # 0 enables scale-to-zero (the default); 1 keeps one warm pod
|
||||
maxReplicaCount: 6 # keep <= partitions of the topic; more pods than partitions sit idle
|
||||
advanced:
|
||||
horizontalPodAutoscalerConfig:
|
||||
behavior: # passed straight to the HPA
|
||||
scaleDown:
|
||||
stabilizationWindowSeconds: 300
|
||||
policies:
|
||||
- type: Pods
|
||||
value: 1
|
||||
periodSeconds: 60 # remove at most one pod a minute: every removal is a rebalance
|
||||
triggers:
|
||||
- type: kafka
|
||||
metadata:
|
||||
bootstrapServers: kafka.kafka.svc.cluster.local:9092
|
||||
consumerGroup: orders-consumer
|
||||
topic: orders
|
||||
lagThreshold: "100" # target lag PER REPLICA (default 10)
|
||||
activationLagThreshold: "10" # lag must be strictly greater than this to wake from zero
|
||||
offsetResetPolicy: earliest
|
||||
# limitToPartitionsWithLag: "true" # for skewed topics; needs `topic`; not with allowIdleConsumers
|
||||
Reference in New Issue
Block a user