Home > Enterprise >  RabbitMQ management plugin: there is no template when using rewrite target from ingress nginx
RabbitMQ management plugin: there is no template when using rewrite target from ingress nginx

Time:10-04

Kind of a weird one.

I have a cluster of RabbitMQ running on K8, using the rabbitMQ_undefined_template
I've tried using Firefox, Edge and Chrome

What works
Ingress config

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-rabbitmq 
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: nginx-dev
    app.kubernetes.io/component: reverse-proxy
    app.kubernetes.io/managed-by: helm
    niiwaa.com/environment: development
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
  namespace: rabbits
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: dev-rabbitmq
            port: 
              number: 15672
    host: dev.hostname.com

Going to dev.hostname.com in my browser works as expected

If I change the path under spec.rules.http.paths.path to

path: /dev-rabbitmq

Then I get the error message in my browsers and no form to login.

I inspected the network console on both Edge and Firefox. On both cases, they send the request "GET http://dev.hostname.com/js/ejs-1.0.min.js"
Only when my path is set to "/" that it is successful. Otherwise, I get a 404 error.

The reason is that the resource is at http://dev.hostname.com/dev-rabbitmq/js/ejs-1.0.min.js.

CodePudding user response:

Thanks to this question and answers I was able to resolve it.

In my Yaml file for the RabbitMQ cluster, I added an additional config like so

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: dev-rabbitmq
  labels:
    app.kubernetes.io/name: rabbitmq
    app.kubernetes.io/instance: rabbitmq-dev
    app.kubernetes.io/component: task-orchestrator
    app.kubernetes.io/part-of: tasks
    app.kubernetes.io/managed-by: rabbitmqclusters
    niiwaa.com/environment: development
spec:
  rabbitmq:
    additionalConfig: |
      management.path_prefix = /dev-rabbitmq

And I removed the annotation rewrite-target

annotations:
  kubernetes.io/ingress.class: nginx
namespace: rabbits
  • Related