Search code examples
kubernetesrabbitmqkubernetes-ingressazure-aksbitnami

How to expose RabbitMQ AMQP URL deployed on kubernetes to outside the cluster?


I created a RabbitMQ cluster on AKS using Bitnami's packaged RabbitMQ from Azure's marketplace. Using Nginx Ingress Controller I can expose RabbitMQ's admin panel without a problem using this Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-rabbit
  namespace: rabbit
spec:
  rules:
  - host: rabbit.myapi.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: rabbitclusterextension-rabbitmq
            port:
              number: 15672
  ingressClassName: nginx

If I change the port to 5672 to connect a client to the cluster It doesn't work. I read that it is because Nginx Ingress Controller can only expose HTTP and HTTPS and as we know RabbitMQ is served using AMQP protocol.

So my question is how can I expose an AMQP URL so my clients can connect to the cluster from outside the cluster?


Solution

  • Just follow the instructions carefully https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/exposing-tcp-udp-services.md

    I had the wrong namespace on my configmap at first.