'HPA spawns too many pods
This is my hpa configuration.
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: customer-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: customer
minReplicas: 2
maxReplicas: 8
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 70
The assigned memory and cpu limits for the deployment are like below.
resources:
requests:
memory: 660Mi
cpu: 100m
limits:
memory: 860Mi
cpu: 500m
The number of replicas of the deployment is like below.
replicas: 2
When I listed the hpa, it is showed like below.
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
customer-service-hpa Deployment/customer-service 46%/70% 2 8 4 36d
When I deploy the deployment and run
kubectl top pods
the output is like below.
customer-9fddb6649-24r88 7m 294Mi
customer-9fddb6649-6x97x 7m 305Mi
customer-9fddb6649-cpg6g 56m 309Mi
customer-9fddb6649-ldbb2 12m 314Mi
Eventhough the load is low, initially pod count is 4. But the given minimum pod is 2.
Is there any issue in deployment files?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
