<p>I create RabbitMQ cluster inside Kubernetes. I am trying to add loadbalancer. But I cant get the loadbalancer External-IP it is still pending.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
  labels:
    run: rabbitmq
spec:
  type: NodePort
  ports:
  - port: 5672
    protocol: TCP
    name: mqtt
  - port: 15672
    protocol: TCP
    name: ui
  selector:
    run: rabbitmq
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq
spec:
  replicas: 1
  selector:
    matchLabels:
      run: rabbitmq
  template:
    metadata:
      labels:
        run: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:latest
        imagePullPolicy: Always
</code></pre>

<p>And My load balancer is below. I gave loadbalancer 
nodePort is random,
port number is from kubernetes created RabbitMQ mqtt port number,
target port number is from kubernetes created RabbitMQ UI port number </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: loadbalanceservice
  labels:
    app: rabbitmq
spec:
  selector:
    app: rabbitmq
  type: LoadBalancer
  ports:
  - nodePort: 31022
    port: 30601
    targetPort: 31533
</code></pre>

newUser
<p>service type <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="noreferrer">Loadbalancer</a> only works on cloud providers which support external load balancers.Setting the type field to LoadBalancer provisions a load balancer for your Service.It's pending because the environment that you are in is not supporting Loadbalancer type of service.In a non cloud environment an easier option would be to use <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="noreferrer">nodeport</a> type service. Here is a <a href="https://www.google.com/url?client=internal-element-cse&amp;cx=013288817511911618469:elfqqbqldzg&amp;q=https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/&amp;sa=U&amp;ved=2ahUKEwiwsIfu3tvnAhUE7XMBHUr6Dc8QFjABegQIABAC&amp;usg=AOvVaw2xemJrr-YnxgclrhnJhrDU" rel="noreferrer">guide</a> on using Nodeport to access service from outside the cluster.</p>
