RabbitMQ: unknown field "ports" in com.rabbitmq.v1beta1.RabbitmqCluster.spec.service
search cancel

RabbitMQ: unknown field "ports" in com.rabbitmq.v1beta1.RabbitmqCluster.spec.service

book

Article ID: 293147

calendar_today

Updated On:

Products

VMware RabbitMQ

Issue/Introduction

Customer wanted to set the NodePort for the RabbitMQ server pod, but it threw out the below error message:
error: error validating "upstream.yml": error validating data: ValidationError(RabbitmqCluster.spec.service): unknown field "ports" in com.rabbitmq.v1beta1.RabbitmqCluster.spec.service; if you choose to ignore these errors, turn validation off with --validate=false

Below is the customer's yaml file:
---
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: upstream-prd
  namespace: rabbitmq-cluster
spec:
  replicas: 3
  tls:
    secretName: tls-secret-new
  persistence:
    storageClassName: ontap-nas
    storage: 100Gi
  service:
    type: NodePort
    ports:
     - port: 5672
       targetPort: 5672
       NordPort: 30572
    rabbitmq:
    additionalPlugins:


Resolution

The RabbitmqCluster resource does not support  spec.ports and that is why it threw out the above error.

To resolve this issue use the override property option which is discussed in detail here. Override the RabbitmqCluster with override keyword.
For example:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: hello-world
spec:
  service:
    type: NodePort
  override:
   service:
     spec:
       ports:
         - appProtocol: http
           name: management
           nodePort: 32555
           port: 15672
           protocol: TCP
           targetPort: 15672
Please note: This is an advanced feature that allows you to enable features that are not explicitly supported but can easily render your RabbitMQ Cluster unusable if used incorrectly.

After applying resolution, try accessing the RabbitMQ management GUI. Based on the example above the RabbitMQ management UI can be accessed on port 32555.

32555.jpg