I'm trying to set up a few micro services in Kubernetes. Everything is working as expected, except the connection from one micro service to RabbitMQ.
Problem flow:
- .NET Core app --> rabbitmq-kubernetes-service.yml --> RabbitMQ
In the .NET Core app the rabbit connection factory config looks like this:
"RabbitMQ": {
"Host": "rabbitmq-service",
"Port": 7000,
"UserName": "guest",
"Password": "guest"
}
The kubernetes rabbit service looks like this:
apiVersion: v1
kind: Service
metadata:
name: rabbitmq-service
spec:
selector:
app: rabbitmq
ports:
- port: 7000
targetPort: 5672
As well as the rabbit deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: <private ACR with vanilla cfg - the image is: rabbitmq:3.7.9-management-alpine>
imagePullPolicy: Always
resources:
limits:
cpu: "1"
memory: 512Mi
requests:
cpu: "0.5"
ports:
- containerPort: 5672
So this setup is currently not working in k8s. Locally it works like a charm with a basic docker-compose.
However, what I can do in k8s is to go from a LoadBalancer --> to the running rabbit pod and access the management GUI with these config settings.
apiVersion: v1 kind: Service metadata: name: rabbitmqmanagement-loadbalancer spec: type: LoadBalancer selector: app: rabbitmq ports: - port: 80 targetPort: 15672
Where am I going wrong?