I have docker-compose file with rabbitmq management image running. I am able to access UI for management.
$ cat docker-compose.yml
---
version: '3.7'
services:
rabbitmq:
image: rabbitmq:management
ports:
- '5672:5672'
- '15672:15672'
environment:
RABBITMQ_DEFAULT_VHOST: storage-collector-dev
RABBITMQ_DEFAULT_USER: dev
RABBITMQ_DEFAULT_PASS: dev
I am trying to convert that to Kubernetes Pods and services.
I am using Mac to run minikube.
Here are my files
$ tree kubernetes/
kubernetes/
└── coreservices
├── rabbitmq_pod.yml
└── rabbitmq_service.yml
$ cat kubernetes/coreservices/rabbitmq_pod.yml
---
apiVersion: v1
kind: Pod
metadata:
name: rabbitmq-pod
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq-pod
image: rabbitmq:management
ports:
- containerPort: 5672
name: amqp
- containerPort: 15672
name: http
env:
- name: RABBITMQ_DEFAULT_VHOST
value: storage-collector-dev
- name: RABBITMQ_DEFAULT_USER
value: dev
- name: RABBITMQ_DEFAULT_PASS
value: dev
...
$ cat kubernetes/coreservices/rabbitmq_service.yml
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
type: NodePort
selector:
app: rabbitmq
ports:
- port: 5672
targetPort: 5672
name: amqp
- port: 15672
targetPort: 15672
nodePort: 31672
name: http
...
Then I apply these files
$ kubectl apply -f kubernetes/coreservices/
pod/rabbitmq-pod created
service/rabbitmq created
It creates services and pods. I get the IP for minikube
to access the management UI for the rabbitmq.
$ minikube IP
127.0.0.1
When I try to access using http://127.0.0.1:31672
, it gives no page found an error.
You need to run the command minikube service rabbitmq
, and then for getting the URL minikube service rabbitmq --url