How to expose Kubernetes-hosted RabbitMQ to the outside?

8/10/2020

We use a kubernetes cluster with installed HAProxy Ingresses. We want to expose RabbitMQ outside of the kubernetes cluster. How is this possible?

Requirement: This is a shared k8s cluster based on OpenShift, where the only way to expose services is using the ingresses.

  1. Management-UI provides basic REST-endpoints which shall not be used for a big amount of data
  2. STOMP-Websockets looks really unmaintained. Not only the protocoll but also the client libs
  3. MQTT-Websockets looks not so bad like STOMP but also not very future-proof
  4. own REST-service can be lots of work
  5. AMQP not possible to expose via HAProxy

I can't imagine that we are the first who needs to connect to RabbitMQ hosted in Kubernetes?!?

The client needs to be .net based

-- masterchris_99
.net
c#
kubernetes
rabbitmq

1 Answer

8/11/2020

Just define aServiceof typeNodePortfor every compoment you want to expose outside the cluster By defaul you'll have to "map" the port from your component to a port in the range 32000-32767, and you'll be able to access your components with those ports

Basically, a NoperPort service will make each node of your cluster listen on the port from the service and route the traffic to the right pods on the right port. There is no protocol restrictions as for Ingress/Routes

k8s services

OCP doc on nodeport

UPDATED
This does not answer the problem at all as the requirement as "the only way to expose services is using the ingresses."

-- titou10
Source: StackOverflow