<p>I am using this helm chart to configure rabbitmq on k8s cluster:
<a href="https://github.com/helm/charts/tree/master/stable/rabbitmq" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/rabbitmq</a></p>

<p>How can I make cluster accessible thru public endpoint? Currently, I have a cluster with below configurations. I am able to access the management portal by given hostname (publicly endpoint, which is fine). But, when I checked inside the management portal cluster can be accessible by internal IP and/or hostname which is: <code>rabbit@rabbitmq-0.rabbitmq-headless.default.svc.cluster.local</code> and <code>rabbit@&lt;private_ip&gt;</code>. I want to make cluster public so all other services which are outside of VNET can connect to it.</p>

<pre><code>helm install stable/rabbitmq --name rabbitmq \
  --set rabbitmq.username=xxx \
  --set rabbitmq.password=xxx \
  --set rabbitmq.erlangCookie=secretcookie \
  --set rbacEnabled=true \
  --set ingress.enabled=true \
  --set ingress.hostName=rabbitmq.xxx.com \
  --set ingress.annotations."kubernetes\.io/ingress\.class"="nginx" \
  --set resources.limits.memory="256Mi" \
  --set resources.limits.cpu="100m"
</code></pre>

<p>I was not tried with Helm but I was build and deploy to Kubernetes directly from <code>.yaml</code> configure file. So I only followed the <a href="https://github.com/helm/charts/blob/master/stable/rabbitmq/templates/svc.yaml" rel="nofollow noreferrer">Template of Helm</a></p>

<p>For publish you RabbitMQ service out of cluster</p>

<p>1, You need to have an external IP:</p>

<p>If you using Google Cloud, run these commands:</p>

<pre><code>gcloud compute addresses create rabbitmq-service-ip --region asia-southeast1
gcloud compute addresses describe rabbitmq-service-ip --region asia-southeast1
&gt;address: 35.240.xxx.xxx
</code></pre>

<p>Change <code>rabbitmq-service-ip</code> to the name you want, and change the <code>region</code> to your own.</p>

<p>2, Configure <code>Helm</code> parameter</p>

<p><code>service.type=LoadBalancer</code></p>

<p><code>service.loadBalancerSourceRanges=35.240.xxx.xxx/32</code> # IP address you got from <code>gcloud</code></p>

<p><code>service.port=5672</code></p>

<p>3, Deploy and try to telnet to your RabbitMQ service</p>

<pre><code>telnet 35.240.xxx.xxx 5672
Trying 35.240.xxx.xxx...
Connected to 149.185.xxx.xxx.bc.googleusercontent.com.
Escape character is '^]'.
</code></pre>

<p>Gotcha! It's worked</p>

<p>FYI:</p>

<p>Here is base template if you want to create <code>.yaml</code> and deploy without Helm</p>

<p><code>service.yaml</code></p>

<pre><code>---
apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
  labels:
    name: rabbitmq
  namespace: smart-office
spec:
  type: LoadBalancer
  loadBalancerIP: 35.xxx.xxx.xx
  ports:
    # the port that this service should serve on
  - port: 5672
    name: rabbitmq
    targetPort: 5672
    nodePort: 32672
  selector:
    name: rabbitmq
</code></pre>

<p><code>deployment.yaml</code></p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: rabbitmq
  labels:
    name: rabbitmq
  namespace: smart-office
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: rabbitmq
      annotations:
        prometheus.io/scrape: "false"
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:3.6.8-management
        ports:
        - containerPort: 5672
          name: rabbitmq
        securityContext:
          capabilities:
            drop:
              - all
            add:
              - CHOWN
              - SETGID
              - SETUID
              - DAC_OVERRIDE
          readOnlyRootFilesystem: true
      - name: rabbitmq-exporter
        image: kbudde/rabbitmq-exporter
        ports:
        - containerPort: 9090
          name: exporter
      nodeSelector:
        beta.kubernetes.io/os: linux
</code></pre>

<p>Hope this help!</p>
