Horizontal Pod Autoscaler is an API resource in the Kubernetes and used to horizontally scale number of kubernetes pods based on metrics values
Questions tagged [hpa]
223 questions
14
votes
8 answers
Metrics server is currently unable to handle the request
I am new to kubernetes and was trying to apply horizontal pod autoscaling to my existing application. and after following other stackoverflow details - got to know that I need to install metric-server - and I was able to - but some how it's not…

Avinash Jain
- 151
- 1
- 2
- 5
11
votes
2 answers
Kubernetes Service not distributing the traffic evenly among pods
I am using Kubernetes v1.20.10 baremetal installation. It has one master node and 3 worker nodes. The application simply served HTTP requests.
I am scaling the deployment based on the (HPA) Horizontal Pod Autoscaler and I noticed that the load is…

Anthony Vinay
- 513
- 5
- 17
11
votes
1 answer
Time-based scaling with Kubernetes CronJob: How to avoid deployments overriding minReplicas
I have a HorizontalPodAutoscalar to scale my pods based on CPU. The minReplicas here is set to 5:
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: myapp-web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind:…

MDalt
- 1,681
- 2
- 24
- 46
8
votes
2 answers
GKE - HPA using custom metrics - unable to fetch metrics
I have custom metrics exported to Google Cloud Monitoring and i want to scale my deployment according to it.
This is my HPA:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: -hpa
namespace:…

Montoya
- 2,819
- 3
- 37
- 65
7
votes
1 answer
How to implement Kubernetes horizontal pod autoscaling with scale up/down policies?
Kubernetes v1.19 in AWS EKS
I'm trying to implement horizontal pod autoscaling in my EKS cluster, and am trying to mimic what we do now with ECS. With ECS, we do something similar to the following
scale up when CPU >= 90% after 3 consecutive 1-min…

Chris F
- 14,337
- 30
- 94
- 192
7
votes
1 answer
How to prevent scale down of newly scaled up pod for specific period of time which was created by HPA in Kubernetes?
I have a Kubernetes cluster set up in DigitalOcean. The cluster is configured to auto-scale using HPA(Horizontal Pod Autoscaler). I want to prevent termination of a pod that got scaled up in the last 1 hour to avoid thrashing and saving the…

Nitesh
- 1,067
- 1
- 10
- 19
7
votes
2 answers
How Kubernetes computes CPU utilization for HPA?
I want to understand how HPA computes CPU utilization across Pods.
According to this doc it takes the average of CPU utilization of a pod (average across the last 1 minute) divided by the CPU requested by the pod. Then it computes the arithmetic…

Mouna
- 3,221
- 3
- 27
- 38
6
votes
1 answer
Kubernetes HPA is flapping replicas regardless of stabilisation window
According to the K8s documentation, to avoid flapping of replicas property stabilizationWindowSeconds can be used
The stabilization window is used to restrict the flapping of replicas when the metrics used for scaling keep fluctuating. The…

Dmytro Patserkovskyi
- 633
- 1
- 8
- 19
6
votes
4 answers
K8S Ingress: How to limit requests in flight per pod
I am porting an application to run within k8s. I have run into an issue with ingress. I am trying to find a way to limit the number of REST API requests in flight at any given time to each backend pod managed by a deployment.
See the image below…

Allen
- 3,134
- 5
- 29
- 49
5
votes
3 answers
Kubernetes HPA -- Unable to get metrics for resource memory: no metrics returned from resource metrics API
Good afternoon
I'm just starting with Kubernetes, and I'm working with HPA (HorizontalPodAutoscaler):
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: find-complementary-account-info-1
spec:
scaleTargetRef:
…

Cesar Justo
- 707
- 2
- 11
- 35
5
votes
1 answer
Horizontal scaling based on the number of events published in NATS server
I am new to both Nats and Kubernetes.
I created a python console application that is subscribed to nats-server and wrapped in a pod with a Deployment object in Kubernetes. Now I want to auto-scale the pod based on the number of events published in…

Sazzad
- 773
- 11
- 22
5
votes
1 answer
How to supply external metrics into HPA?
Problem setting. Suppose I have 2 pods, A and B. I want to be able to dynamically scale pod A based on some arbitrary number from some arbitrary source. Suppose that pod B is such a source: for example, it can have an HTTP server with an endpoint…

Timur Nugmanov
- 803
- 9
- 16
4
votes
3 answers
Unable to fetch metrics from custom metrics API: the server is currently unable to handle the request
I'm using a HPA based on a custom metric on GKE.
The HPA is not working and it's showing me this error log:
unable to fetch metrics from custom metrics API: the server is currently unable to handle the request
When I run kubectl get apiservices |…

mohamed wael thabet
- 195
- 2
- 4
- 12
4
votes
2 answers
HPA on AWS EKS with Fargate
I have AWS EKS cluster with only Fargate profile, no Node Groups.
Is it possible to enable HPA in this case? I tried to enable metric server as described here but pod creation fails with error
0/4 nodes are available: 4 node(s) had taint…

yurybubnov
- 357
- 2
- 11
4
votes
1 answer
Error scaling up in HPA in GKE: apiserver was unable to write a JSON response: http2: stream closed
Following the guide that google made for deploying an HPA in Google Kubernetes Engine: https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics
And adding the right permissions because I am using Workload Identity with this…

ourobor93
- 372
- 1
- 7
- 21