not able to acess rabbit mq on port 15672 using replication controller and services

11/11/2017

Here is my ReplicationController:

apiVersion: v1 
kind: ReplicationController
metadata:
  name: rmq-rc1234
spec:
  selector:
    app: rmq
  replicas: 1 
  template: 
    metadata:    
      labels:
        app: rmq
    spec:
      containers:
      - name: rmq
        image: rabbitmq
        env:
        - name: RABBITMQ_DEFAULT_USER
          value: "rabbitmq"
        - name: RABBITMQ_DEFAULT_PASS
          value: "rabbitmq"
        ports: 
        - containerPort: 5672
        - containerPort: 15672

below is my Service file:

apiVersion: v1
kind: Service
metadata:
  name: rmq-svc
  labels:
    app: rmq
spec:
  type: NodePort 
  ports:
  - port: 15672
    name: port-mgmt
    nodePort: 30006
    protocol: TCP
  - port: 5672
    name: port-actual
    nodePort: 30007
    protocol: TCP
  selector:
    app: rmq

The result of kubebctl get pods is:

rmq-rc1234-msdbf     1/1       Running   0          9h

The output of kubectl logs is:

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Waiting for Mnesia tables for 30000 ms, 9 retries left

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Waiting for Mnesia tables for 30000 ms, 9 retries left

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Waiting for Mnesia tables for 30000 ms, 9 retries left

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Priority queues enabled, real BQ is rabbit_variable_queue

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Starting rabbit_node_monitor

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Adding vhost '/'

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Creating user 'rabbitmq'

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Setting user tags for user 'rabbitmq' to [administrator]

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
Setting permissions for 'rabbitmq' in '/' to '.*', '.*', '.*'

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
msg_store_transient: using rabbit_msg_store_ets_index to provide index

=INFO REPORT==== 10-Nov-2017::21:17:43 ===
msg_store_persistent: using rabbit_msg_store_ets_index to provide index

=WARNING REPORT==== 10-Nov-2017::21:17:43 ===
msg_store_persistent: rebuilding indices from scratch

=INFO REPORT==== 10-Nov-2017::21:17:44 ===
started TCP Listener on [::]:5672
 completed with 0 plugins.

=INFO REPORT==== 10-Nov-2017::21:17:44 ===
Server startup complete; 0 plugins started.

=INFO REPORT==== 10-Nov-2017::21:18:07 ===
accepting AMQP connection <0.374.0> (10.44.0.0:51450 -> 10.44.0.13:5672)

=ERROR REPORT==== 10-Nov-2017::21:18:07 ===
closing AMQP connection <0.374.0> (10.44.0.0:51450 -> 10.44.0.13:5672):
{bad_header,<<"GET / HT">>}

I am not able to get any response of port 15672 through web browser. But I'm getting some hint of response from port 5672 and logs are also confirming the same.

Can someone please help me with accessing the RabbitMQ with web browser?

-- user3231140
kubernetes
rabbitmq

1 Answer

11/11/2017

You created RabbitMQ pod using image rabbitmq which doesn't have management plugin installed.

In order to have WEB access to your RabbitMQ, you need to use rabbitmq:3-management image:

apiVersion: v1 
kind: ReplicationController
metadata:
  name: rmq-rc1234
spec:
  selector:
    app: rmq
  replicas: 1 
  template: 
    metadata:    
      labels:
        app: rmq
    spec:
      containers:
      - name: rmq
        image: rabbitmq:3-management
        env:
        - name: RABBITMQ_DEFAULT_USER
          value: "rabbitmq"
        - name: RABBITMQ_DEFAULT_PASS
          value: "rabbitmq"
        ports: 
        - containerPort: 5672
        - containerPort: 15672
-- nickgryg
Source: StackOverflow