# How to increase resource requirements of the migration job for an AWX deployed via K8s

**URL:** <https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050>\
**Category:** Get Help\
**Tags:** awx, kubernetes\
**Created:** [November 22, 2024, 1:28am UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050 "2024-11-22T01:28:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [November 22, 2024, 1:28am UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/1 "2024-11-22T01:28:07Z")

</div>

Hello!  
I just deployed AWX 24.6.0 in kubernetes with a fresh unmanaged postgres DB with Operator version: 2.19.0.

The operator scales the web deployment and the task deployment, however I have this migration job that gets spawned and launches migration pod that keep on getting OOM killed.

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/2/2f00ee3bc1babd23e04ea2c2a512db5e9bc7c301.png)

Is there a way to increase the memory limit for the container in the spawned pod by the job? I haven’t found a field for this from the following list documented: [Containers Resource Requirements - Ansible AWX Operator Documentation](https://ansible.readthedocs.io/projects/awx-operator/en/latest/user-guide/advanced-configuration/containers-resource-requirements.html)

```auto
spec:
  containers:
    - command:
        - awx-manage
        - migrate
        - '--noinput'
      image: '<path/to/registry>/ansible/awx:24.6.0'
      imagePullPolicy: IfNotPresent
      name: migration-job
      resources:
        limits:
          cpu: '1'
          memory: 100Mi
        requests:
          cpu: 100m
          memory: 50Mi

```

---

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [November 22, 2024, 1:56am UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/2 "2024-11-22T01:56:06Z")

</div>

I saw in the project repo that it is set as a variable: [awx-operator/roles/installer/templates/jobs/migration.yaml.j2 at 9718424483347c0ddd94b5eb6eff88d54226028a · ansible/awx-operator · GitHub](https://github.com/ansible/awx-operator/blob/9718424483347c0ddd94b5eb6eff88d54226028a/roles/installer/templates/jobs/migration.yaml.j2#L39)

however, my task\_resource\_requirements is defined as

```
      resources:
        limits:
          cpu: '4'
          memory: 4Gi
        requests:
          cpu: '1'
          memory: 1Gi

```

hmm doesn’t seem possible ? [awx-operator/roles/installer/tasks/migrate\_schema.yml at 9718424483347c0ddd94b5eb6eff88d54226028a · ansible/awx-operator · GitHub](https://github.com/ansible/awx-operator/blob/9718424483347c0ddd94b5eb6eff88d54226028a/roles/installer/tasks/migrate_schema.yml#L36)

@Denney-tech think you could point me in the right direction please?

---

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [November 22, 2024, 3:19am UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/3 "2024-11-22T03:19:12Z")

</div>

So i tried to bump the operator’s version to 2.19.1 to get the template file [with the resources specified](https://github.com/ansible/awx-operator/blob/dd37ebd440edf953d822f2c134833a44a8e77532/roles/installer/templates/jobs/migration.yaml.j2#L21), however it seems the image was built incorrectly or the wrong image was published to the registry in [quay.io](http://quay.io) ?

```auto
$ podman run -it --entrypoint "" <company-registry>.com/prod-docker/ansible/awx-operator:2.19.1 grep -A 20 'migration-job' 'roles/installer/templates/jobs/migration.yaml.j2'
        - name: "migration-job"
          image: '{{ _image }}'
          command:
            - awx-manage
            - migrate
            - --noinput
          volumeMounts:
            - name: {{ ansible_operator_meta.name }}-application-credentials
              mountPath: "/etc/tower/conf.d/credentials.py"
              subPath: credentials.py
              readOnly: true
            - name: "{{ secret_key_secret_name }}"
              mountPath: /etc/tower/SECRET_KEY
              subPath: SECRET_KEY
              readOnly: true
            - name: {{ ansible_operator_meta.name }}-settings
              mountPath: "/etc/tower/settings.py"
              subPath: settings.py
              readOnly: true
            {{ lookup("template", "common/volume_mounts/extra_settings_files.yaml.j2") | indent(width=12) | trim }}
{% if bundle_ca_crt %}

```

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [November 23, 2024, 3:54pm UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/4 "2024-11-23T15:54:35Z")

</div>

First, the template file for migration jobs is only specifying resources for the _init_ container, not the main container. So, you’re probably getting the correct image from [quay.io](http://quay.io), just not the resource settings you were expecting.

Secondly, I’ve never seen the migration job get OOM-killed. While this could be remedied with setting resource limits, I would suspect the underlying k8s platform has insufficient resources for the new AWX cluster. So, even if you manage to get the migration job to complete somehow without it getting OOM-killed, the rest of the AWX pods may get OOM-killed once they start up afterwards as well.

---

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [November 23, 2024, 4:07pm UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/5 "2024-11-23T16:07:56Z")

</div>

Got you, i was able to fix my problem by editing the container template migration file with resources limts/requests high enough so that they don’t get killed.

> While this could be remedied with setting resource limits, I would suspect the underlying k8s platform has insufficient resources for the new AWX cluster

our k8s admins enforces a default limit when none are specified that was the reason why it was getting oom killed.

---

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [November 23, 2024, 4:08pm UTC](https://forum.ansible.com/t/how-to-increase-resource-requirements-of-the-migration-job-for-an-awx-deployed-via-k8s/11050/6 "2024-11-23T16:08:33Z")

</div>

thanks for taking a peek!
