I have followed the k8s document for setup the HPA based on CPU percentage(CPU >50%) for one of the my deployment and Configured scaling behavior and specify a stabilization window that prevents flapping
the replica count for a scaling target.
behavior:
scaleDown:
stabilizationWindowSeconds: 180
policies:
- type: Percent
value: 10
periodSeconds: 30
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Pods
value: 4
periodSeconds: 30
selectPolicy: Max
After created HPA, increased the load the deployment to test the HPA and it’s was working as per the configuration.
NAME REFERENCE TARGET MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache/scale 105% / 50% 1 10 3 3m
Based on the scaleUp stabilizationWindowSeconds
configuration, it is creating the only 4 pods in 30 seconds period if the CPU % is more then 50(as per the above o/p the CPU value is 105%) and it not importing the application/user.
If suddenly traffic increased and CPU percentage will reached to more the 300%, above scaleUp
conditions are impacting the end users and requests are in queue till new required pods come to online to serve the traffic.
Is there any way to set the behavior.scaleUp.policies.value
value dynamically based on CPU percentages?
I want to scale up the Pods count in 15 sec like below