# HostAlias not getting updated on automation-job POD (AWX-Operator)

**URL:** <https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986>\
**Category:** Get Help\
**Tags:** awx-operator, awx, ee, kubernetes\
**Created:** [October 26, 2023, 9:47pm UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986 "2023-10-26T21:47:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell.cecala](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russell.cecala/32/1028_2.png) [@russell.cecala](https://forum.ansible.com/u/russell.cecala)\
**Post date:** [October 26, 2023, 9:47pm UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986/1 "2023-10-26T21:47:20Z")

</div>

I recently had to move my K3 cluster running AWX-operator. The IP addresses of my nodes had to change from 10.0.3.51, 10.0.3.52, 10.0.3.53 to 10.6.3.44, 10.6.3.45, 10.6.3.71. I updated hostAlias in my awx-demo deployment:

```auto
271 dnsPolicy: ClusterFirst
272 hostAliases:
273 - hostnames:
274 - awx.example.com
275 ip: 10.6.3.44
276 initContainers:
277 - command:
278 - /bin/sh
279 - -c
280 - |
281 hostname=$MY_POD_NAME
282 receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
283 receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/ receptor.crt verify=yes

```

This works for my awx-demo-ee POD and containers but my Ansible code gets executed on the `automation-job` PODs and its /etc/hosts file has the old IP.

```auto
$ kubectl -n awx exec -it automation-job-19120-2npln -- bash
bash-4.4$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.42.1.31 automation-job-19120-2npln

# Entries added by HostAliases.
10.0.3.51 awx.example.com

```

Please help. I am using awx-operator on a k3 cluster. Thanks

If you prefer I posted a question to [kubernetes - HostAlias being ignored in AWX-operator PODs - Server Fault](https://serverfault.com/questions/1146673/hostalias-being-ignored-in-awx-operator-pods) also.

---

<div class="post-metadata">

**Author:** ![disi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/disi/32/1138_2.png) [@disi](https://forum.ansible.com/u/disi)\
**Post date:** [October 27, 2023, 7:05am UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986/2 "2023-10-27T07:05:29Z")

</div>

Interesting, I just read about it here:

> **[Adding entries to Pod /etc/hosts with HostAliases](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/)**
>
> Adding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.
> The Kubernetes project recommends...

Do you have pod for host aliases in your cluster?

p.s. just read you did update 🙂

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [October 27, 2023, 12:16pm UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986/3 "2023-10-27T12:16:08Z")

</div>

To customize pod specification for your automation job pods, you should define Container Groups with customized pod specification that contains `hostAliases`, and specify it in Job Templates or Organizations.

Probably you already have the one with old IP addresses?

[https://docs.ansible.com/automation-controller/latest/html/administration/containers\_instance\_groups.html#customize-the-pod-spec](https://docs.ansible.com/automation-controller/latest/html/administration/containers_instance_groups.html#customize-the-pod-spec)

By the way how did you inject `hostAliases` to your AWX deployment means `awx-task` and `awx-web` deployments?

---

<div class="post-metadata">

**Author:** ![russell.cecala](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russell.cecala/32/1028_2.png) [@russell.cecala](https://forum.ansible.com/u/russell.cecala)\
**Post date:** [October 27, 2023, 3:03pm UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986/4 "2023-10-27T15:03:21Z")

</div>

That was it. I had to update my ‘default’ Instance Group in the AWX Web UI Administration \>\> Instance Groups. Thanks from saving me from totally wrecking my AWX Tower.

---

<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:** [November 26, 2023, 3:03pm UTC](https://forum.ansible.com/t/hostalias-not-getting-updated-on-automation-job-pod-awx-operator/1986/5 "2023-11-26T15:03:49Z")

</div>

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