diff --git a/k8s/autoscale.yaml b/k8s/autoscale.yaml index 9509b9f..d23436a 100644 --- a/k8s/autoscale.yaml +++ b/k8s/autoscale.yaml @@ -18,3 +18,23 @@ spec: target: type: Utilization averageUtilization: 60 + behavior: + scaleUp: + # Wait 2min of sustained high CPU before scaling up. Schemas is + # event-driven and the per-request work is bursty even with the + # cache + warmup, so single spikes shouldn't pull replicas up. + stabilizationWindowSeconds: 120 + policies: + - type: Pods + value: 1 + periodSeconds: 60 + scaleDown: + # Default 300s window kept pods pinned at maxReplicas long after + # the triggering spike had subsided. 120s is long enough to avoid + # flapping but lets the deployment return to minReplicas quickly + # once the workload calms. + stabilizationWindowSeconds: 120 + policies: + - type: Pods + value: 1 + periodSeconds: 60