Kind of a weird one.
I have a cluster of RabbitMQ running on K8, using the RabbitMQ Cluster Kubernetes Operator. Nothing fancy for the Yaml config file. The name of the RabbitMQ service is dev-rabbitmq. The port 15672 (default) is to have access to the Management UI. Port forwarding works fine.
I have set-up a Ingress Nginx service to be able to customize the url in my browser. This, in order to have only one load balancer and have different URLs for different services
There are 2 scenarios, one which works (but not what I'm looking for). The other I get the below error message being displayed (and no option to login) only for Firefox.
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.
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