Good afternoon. I am working with HPA (HorizontalPodAutoscaler) for the automatic scaling of replicas of a pods, in this case I am using memory usage as a reference, I declare it as follows:
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: find-complementary-account-info-1
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: find-complementary-account-info-1
minReplicas: 2
maxReplicas: 5
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 70
What I want is to automatically scale my pods when the use of the pod's memory percentage is greater than 70%, and when this percentage drops my replicas return to the declared minimum, however, doing tests, I place a limit at 70, without However, when memory usage is lower than this value, the replicas continue in 4.
5 minutes have passed, and this is what the HPA shows:
[dockermd@tmp108 APP-MM-ConsultaCuentaPagadoraPospago]$ kubectl get hpa -o wide
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
find-complementary-account-info-1 Deployment/find-complementary-account-info-1 65%/70% 2 5 4 2d4h
I have a wrong concept of HPA or I am declaring the configuration for the HPA in the wrong way, or how to reduce the number of replicas as soon as the memory usage is below the indicated
My environment is on-premise and is configured with metalb, and I use LoadBalancer to expose my services