Hello I am trying to configure HPA with multiple metric and single metric basically with CPU and Memory.
I have used this and created an HPA in which I have set is the average utilization of 70 %, but if pod reaches 71% also scaling is not happening, Once scaled up it is onot scaling down even if the value goes below 70%. When I tried to use single metric of CPU, it is scaling up and scaling down. And when 2 metric are used, like CPU and memory, it scaled up due to CPU high, memory is still less than target, cpu is also less than target, ideally it should have been reduced, but it is not reducing.
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageUtilization: 07
Could you please help where i m missing?
I’ll admit that I don’t have much practical experience with HPA. Are you working from a particular tutorial? The docs themselves are opaque, and I would not want to try to get this working based on them alone. I did find a more useful tutorial here: How to Configure Kubernetes Horizontal Pod Autoscaler using Metrics Server | DigitalOcean
From your email to support:
Hello Rob,
Not any specific tutorial, I m checking the documentation available as such and more over document only specifies about cpu usage part but not anything more memory.
And about muti metric configuration details as well i m not getting much help over the internet.
Regards,
Nirmal
This is a difficult topic, and it’s comparatively new, so there aren’t a lot of tutorials out there. But I would definitely start with those, since the docs are very dense, and I don’t think they’re well organized for getting started with HPA.
Memory will be a bit problematic since a lot of memory allocation is for very short term tasks like processing a file on read, or handling a single web request. For tasks where memory is allocated, used, and immediately deallocated, it makes no sense to schedule a new pod. So it may be difficult to test these kind of cases. I don’t have a good answer for you as how best to do that.
You might try using the #kubernetes-users channel of Kubernetes Slack, since this is a good way to find people who are early adopters of new K8s features. Good luck.