0

i have 2 questions:

1 - i'd like to know if i can set my hpa to compare the limits resources instead of the requests resources with the target utilization i choose for memory and cpu(i'm using normal metrics, not external or custom ones).

2 - i encountered the problem where i created a hpa that should scale up my deployment if memory or cpu hit 80%, now the app itself baseline usage is around 65% avg memory. so at peak times the hpa create another pod which is fine. the problem starts when scale down cant occur because of the calculation the hpa use to determine the desired replicas(it turns 1.1 >= to 2 pods) so for scale down to occur the avg memory should be around 50% which cant be. i tried to change the resources a bit and couldnt get fine results.

i'd be happy to get some advices

1 Answer 1

1

1. No, you can't. HPA's built-in resource metrics always use requests, not limits.

If you need limits-based scaling, use custom metrics instead.

2. Quick fix - Increase resource requests:

Alternative approaches:

Lower HPA target from 80% to 70%

Tune scale-down behavior:

spec:
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 60
      policies:
      - type: Percent
        value: 50
        periodSeconds: 60

Your requests should be set so baseline usage = ~50-60% of requests, giving HPA room to scale down properly.

if you want to scale at 80% but need scale-down at 50%, set requests = baseline_usage / 0.5. So 650MB baseline needs ~1.3GB requests.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.