Rachel Ambler
Rachel Ambler

Reputation: 1594

RabbitMq cluster operator and loadBalancerIP

I'm trying to get a RabbitMq Cluster configured with a load balancer IP (I know it's being deprecated at some point, but that's not apparently yet) and I'm having problems getting the service definition correct.

Here's what it starts with:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: rabbitmq-cluster
  namespace: rabbitmq
spec:
  replicas: 3
  rabbitmq:
    additionalConfig: |
      loopback_users.guest = false
  service:
    type: LoadBalancer
    loadBalancerIP: 10.191.2.17
    annotations:
      load-balancer/rabbitmq: "true"

If I run without the loadBalancerIP line in, the cluster starts fine, but not on the IP address I want it on.

With it in I'm getting the following error:

Error from server (BadRequest): error when creating "RabbitMq .yaml": RabbitmqCluster in version "v1beta1" cannot be handled as a RabbitmqCluster: strict decoding error: unknown field "spec.service.loadBalancerIP".

Edit:

If it’s not possible then could I do something like place an nginx server in front of the ClusterIP? If so would someone be able to held with the appropriate yaml?

Upvotes: 1

Views: 475

Answers (1)

Rachel Ambler
Rachel Ambler

Reputation: 1594

Thanks to the reply by @QuentinGeff, I was able to come up with the following service that does the trick:

apiVersion: v1
kind: Service
metadata:
  name: rabbitmq-loadbalancer
  namespace: rabbitmq
spec:
  type: LoadBalancer
  loadBalancerIP: 10.191.2.17
  ports:
    - name: amqps
      port: 5671
      protocol: TCP
      targetPort: 5671
    - name: management-ui
      port: 15671
      protocol: TCP
      targetPort: 15671
  selector:
    app.kubernetes.io/name: RabbitMq-cluster

Upvotes: 1

Related Questions