# HPA on Kubernetes in EKS?

**URL:** <https://forum.ansible.com/t/hpa-on-kubernetes-in-eks/10433>\
**Category:** Get Help\
**Tags:** awx, kubernetes\
**Created:** [October 21, 2024, 7:58pm UTC](https://forum.ansible.com/t/hpa-on-kubernetes-in-eks/10433 "2024-10-21T19:58:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trippinnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/trippinnik/32/4308_2.png) [@trippinnik](https://forum.ansible.com/u/trippinnik)\
**Post date:** [October 21, 2024, 7:58pm UTC](https://forum.ansible.com/t/hpa-on-kubernetes-in-eks/10433/1 "2024-10-21T19:58:50Z")

</div>

[Horizontal Pod Autoscaler (HPA) - Ansible AWX Operator Documentation](https://ansible.readthedocs.io/projects/awx-operator/en/latest/user-guide/advanced-configuration/horizontal-pod-autoscaler.html)

```auto
task_manage_replicas: True

```

I have this in place using awx-operator 2.19.1. My expectation is that when I kick off a lot of jobs I would see the task pod increase in number. I have resource limits set.  
Right now I am seeing the jobs pending and no additional task pods

---

<div class="post-metadata">

**Author:** ![alvaroc20](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alvaroc20/32/3485_2.png) [@alvaroc20](https://forum.ansible.com/u/alvaroc20)\
**Post date:** [October 31, 2024, 4:20pm UTC](https://forum.ansible.com/t/hpa-on-kubernetes-in-eks/10433/2 "2024-10-31T16:20:09Z")

</div>

Hi!

I ran into the same issue initially—I expected it to handle scaling automatically, either by creating an HPA or through internal Operator management, but that’s not the case.

By default, this parameter is set to `true`, meaning it will ALWAYS use the values from `replicas`, `web_management_replicas`, or `task_management_replicas`. This was the previous behavior as well. The new feature now allows you to set it to `false`, which makes it ignore these three parameters. This way, you can create a custom HPA to scale the deployment based on your `requests` values and the chosen metric.

```auto
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: awx-task-memory-hpa
  namespace: awx
spec:
  maxReplicas: 10
  metrics:
  - resource:
      name: memory
      target:
        averageUtilization: 75
        type: Utilization
    type: Resource
  minReplicas: 1
  scaleTargetRef:
    apiVersion: apps/v1
    kind: deployment
    name: awx-task

```

This is an example where `awx-task` scales based on memory. You would need to create another one for `awx-web`, and it would work as you want since you won’t see an issue with CPU.

That percentage is based on the requests you’ve set in the CRD.

```auto
    task_resource_requirements:
      limits:
        cpu: "2"
        memory: 2Gi
      requests:
        cpu: 100m
        memory: 1Gi

```

For `awx-web`, I have 1.5GB in the memory request since, by default, my usage is always around 1.2GB. Still, check your own usage and adjust the values accordingly!

Hope this helps you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 12, 2024, 4:27pm UTC](https://forum.ansible.com/t/hpa-on-kubernetes-in-eks/10433/3 "2024-12-12T16:27:52Z")

</div>

Closed on December 12, 2024, 4:27pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
