<p>I need to configure a TCP port on my AKS Cluster to allow RabbitMQ to work</p>
<p>I have installed nginx-ingress with helm as follows:</p>
<pre><code>kubectl create namespace ingress-basic

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx

helm install nginx-ingress ingress-nginx/ingress-nginx \
    --namespace ingress-basic \
    --set controller.replicaCount=2 \
    --set controller.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux \
    --set defaultBackend.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux \
    --set controller.admissionWebhooks.patch.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux
</code></pre>
<p>I have setup an A record with our DNS provider to point to the public IP of the ingress controller.</p>
<p>I have created a TLS secret (to enable https)</p>
<p>I have created an ingress route with:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: rabbit-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  tls:
  - hosts:
    - my.domain.com
    secretName: tls-secret
  rules:
    - http:
        paths:
          - backend:
              serviceName: rabbitmq-cluster
              servicePort: 15672
            path: /(.*)
</code></pre>
<p>I can navigate to my cluster via the domain name from outside and see the control panel (internally on 15672)  with valid https. So the ingress is up and running, and I can create queues etc... so rabbitmq is working correctly.</p>
<p>However, I can't get the TCP part to work to post to the queues from outside the cluster.</p>
<p>I have edited the yaml of the what I believe is the configmap (azure - cluster - configuration - nginx-ingress-ingress-nginx-controller) for the controller (nginx-ingress-ingress-nginx-controller) via the azure portal interface and added this to the end</p>
<pre class="lang-yaml prettyprint-override"><code>data:
  '5672': 'default/rabbitmq-cluster:5672'
</code></pre>
<p>I have then edited they yaml for the service itself via the azure portal and added this to the end</p>
<pre class="lang-yaml prettyprint-override"><code>  - name: amqp
      protocol: TCP
      port: 5672
</code></pre>
<p>However, when I try to hit my domain using a test client the request just times out. (The client worked when I used a LoadBalancer and just hit the external IP of the cluster, so I know the client code should work)</p>
<p>Is there another step that I should be doing?</p>

Mark McGookin
<p>I believe the issue here was that helm was configuring so much of my own stuff that I wasn't able to customise too much.</p>
<p>I uninstalled the ingress with helm and changed the ingress creation script to this:</p>
<pre class="lang-yaml prettyprint-override"><code>helm install nginx-ingress ingress-nginx/ingress-nginx \
    --namespace ingress-basic \
    --set controller.replicaCount=2 \
    --set controller.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux \
    --set defaultBackend.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux \
    --set controller.admissionWebhooks.patch.nodeSelector.&quot;beta\.kubernetes\.io/os&quot;=linux \
    --set tcp.5672=&quot;default/rabbitmq-cluster:5672&quot;
</code></pre>
<p>Which pre-configures the TCP port forwarding and I don't have to do anything else. I don't know if it effected it, but this seemed to 'break' my SSL implementation, so I upgraded the ingress route creation script from v1beta to v1 and https was working again perfectly.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rabbit-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  tls:
  - hosts:
      - my.domain.com
    secretName: tls-secret
  rules:
  - host: my.domain.com
    http:
      paths:
      - path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: rabbitmq-cluster
            port:
              number: 15672
</code></pre>
