apiVersion: v1
kind: Service
metadata:
  name: rabbit-mq
spec:
  type: LoadBalancer
  selector:
      app: rabbit-mq
  ports:
    - name: management
      port: 15672
      targetPort: 15672
      nodePort: 30301
      protocol: TCP
    - name: message-broker
      port: 5672
      targetPort: 5672
      nodePort: 30302
      protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbit-mq
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbit-mq
  template:
    metadata:
      labels:
        app: rabbit-mq
    spec:
      containers:
      - name: rabbit-mq
        image: rabbitmq:3-management
        ports:
        - containerPort: 15672
        - containerPort: 5672