# AWX cannot access its own REST API (Name or service not known)

**URL:** <https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [March 22, 2023, 6:57pm UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800 "2023-03-22T18:57:34Z")\
**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:** [March 22, 2023, 6:57pm UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800/1 "2023-03-22T18:57:34Z")

</div>

I am running awx-operator on a k3 cluster. I have a role, update\_host\_group, that tries to use the AWX REST API to manipulate Ansible groups.

---

<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:** [March 23, 2023, 1:14am UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800/2 "2023-03-23T01:14:28Z")

</div>

UPDATE: I have tried adding hostAliases to my kubernetes but I am not well versed in k\* admin. I looked at the docs here: [https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/)

But of course that doesn’t tell where in the awx deployment to add the hostAliases stanza. So I am just guessing and breaking things. Does anyone know where I need to put my hostAliases?

---

<div class="post-metadata">

**Author:** ![kurokobo1](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@kurokobo1](https://forum.ansible.com/u/kurokobo1)\
**Post date:** [March 23, 2023, 7:28am UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800/3 "2023-03-23T07:28:55Z")

</div>

Hi,

Adding new record on your upstream DNS server is the best solution,  
but if this is difficult for you, you can define new Container Group with customized pod specification and use it for your Job Template.  
[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)

Regards,

---

<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:** [March 24, 2023, 2:26am UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800/4 "2023-03-24T02:26:07Z")

</div>

Thank you for your response. I didn’t get a chance to test it out yet but that bit of documentation does seem relevant. It is inserting though that I do have up stream DNS records but I do not think the container that is doing to gethostbyname() has a resolver in the /etc/resolv.conf that doesn’t know about my hostname.

---

<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:** [March 24, 2023, 3:40pm UTC](https://forum.ansible.com/t/awx-cannot-access-its-own-rest-api-name-or-service-not-known/37800/5 "2023-03-24T15:40:56Z")

</div>

Thank you kurokobo! That did the trick! I logged on to my awx web ui and navigated to **Administration \> Instance Groups** , then edited the **default** instance group and clicked on the **Customize pod specification** radio button and added these line just above the `containers:` line:

hostAliases:

- hostnames:
- [awx.example.com](http://awx.example.com)  
ip: 10.0.3.52
