# Ingress service in AWX with nginx

**URL:** <https://forum.ansible.com/t/ingress-service-in-awx-with-nginx/36758>\
**Category:** AWX Project\
**Tags:** awx, kubernetes\
**Created:** [June 21, 2022, 6:50am UTC](https://forum.ansible.com/t/ingress-service-in-awx-with-nginx/36758 "2022-06-21T06:50:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mani3887](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mani3887](https://forum.ansible.com/u/mani3887)\
**Post date:** [June 21, 2022, 6:50am UTC](https://forum.ansible.com/t/ingress-service-in-awx-with-nginx/36758/1 "2022-06-21T06:50:41Z")

</div>

Hi,

I followed the below documentation and created the AWX deployment:

[https://github.com/ansible/awx-operator#network-and-tls-configuration](https://github.com/ansible/awx-operator#network-and-tls-configuration)

AWX resource and deployments/awx pods were created as intended. I am facing difficulties in setting up the ingress.

I had the below ingress configuration:  
ingress\_type: ingress  
hostname: [awx.domain.com](http://awx.domain.com)  
ingress\_path: /awx-test  
ingress\_path\_type: Prefix  
ingress\_tls\_secret: awx-tls-secret  
ingress\_annotations: |  
environment: testing

I am using nginix ingress in my cluster; and I was not sure how to provide this information in this configuration.

So I made the service type as Cluster IP, and created custom ingress configuration for this service.

$ kubectl.exe -n awx get svc  
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE  
awx-operator-controller-manager-metrics-service ClusterIP 10.0.118.219 8443/TCP 4d22h  
awx-service ClusterIP 10.0.253.225 80/TCP 56m

$ ./kubectl -n awx describe ingress  
Name: awx-ingress  
Labels:   
Namespace: awx  
Address:   
Default backend: default-http-backend:80 (\<error: endpoints “default-http-backend” not found\>)  
TLS:  
awx-tls-secret terminates [awx-domain.com](http://awx-domain.com)  
Rules:  
Host Path Backends

* * *

[awx-domain.com](http://awx-domain.com)  
/awx-test awx-service:80 (10.244.0.63:8052)  
Annotations: [cert-manager.io/cluster-issuer:](http://cert-manager.io/cluster-issuer:)   
[nginx.ingress.kubernetes.io/rewrite-target:](http://nginx.ingress.kubernetes.io/rewrite-target:) /$2  
[nginx.ingress.kubernetes.io/use-regex:](http://nginx.ingress.kubernetes.io/use-regex:) true  
Events:  
Type Reason Age From Message

* * *

Normal CreateCertificate 14m cert-manager Successfully created Certificate “awx-tls-secret”  
Normal Sync 13m (x2 over 14m) nginx-ingress-controller Scheduled for sync  
Normal Sync 13m (x2 over 14m) nginx-ingress-controller Scheduled for sync

When I configure this and go to the path, I keep getting 502 Bad gateway error. Can someone please let me know what I am doing wrong here?

Thanks and Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![mani3887](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mani3887](https://forum.ansible.com/u/mani3887)\
**Post date:** [June 22, 2022, 9:33am UTC](https://forum.ansible.com/t/ingress-service-in-awx-with-nginx/36758/2 "2022-06-22T09:33:53Z")

</div>

I installed the latest awx operator image with the below definition:

apiVersion: [awx.ansible.com/v1beta1](http://awx.ansible.com/v1beta1)  
kind: AWX  
metadata:  
name: awx-test  
namespace: awx  
spec:  
service\_type: ClusterIP  
service\_annotations: |  
environment: testing  
service\_labels: |  
environment: testing  
postgres\_configuration\_secret: awx-postgres-configuration  
admin\_user: awxadmin  
admin\_email: \<\>  
admin\_password\_secret: awx-admin-password  
image: [quay.io/ansible/awx](http://quay.io/ansible/awx)  
image\_version: latest  
ee\_images:

- name: awx-test-ee  
image: [quay.io/ansible/awx-ee](http://quay.io/ansible/awx-ee)  
redis\_image: [docker.io/redis](http://docker.io/redis)  
redis\_image\_version: latest

I observe that the service is being created. However I am unable to access the service.

$ kubectl -n awx get svc  
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE  
awx-operator-controller-manager-metrics-service ClusterIP 10.0.118.219 8443/TCP 6d1h  
awx-test-service ClusterIP 10.0.26.53 80/TCP 17m

From the worker node, I tried curling this cluster IP.

root@:/# curl [http://10.0.26.53:80](http://10.0.26.53:80)  
curl: (7) Failed to connect to 10.0.26.53 port 80: Connection refused

I am not sure why the curl is failing for the cluster IP. This service has been auto-generated by the operator.

Thanks and Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [June 23, 2022, 5:14pm UTC](https://forum.ansible.com/t/ingress-service-in-awx-with-nginx/36758/3 "2022-06-23T17:14:59Z")

</div>

Hi!

You’ll need to use a NodePort or LoadBalancer type of service to expose the service externally (note the under External-IP). A ClusterIP only routes data internally between pods, but doesn’t allow outside browsers to reach into the pod to access a service.

AWX Team
