<p>I've have RabbitMQ deployment with ClusterIP service.</p>

<p>Deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rabbit-mq
  name: rabbit-mq
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbit-mq
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
         app: rabbit-mq
    spec:
      containers:
      - image: rabbitmq:3.6.1-management
        name: rabbit-mq
        ports:        
        - containerPort: 5672
        volumeMounts:
        - mountPath: /etc/rabbitmq
          name: rabbit-mq-data
      restartPolicy: Always
      hostname: rabbit-mq
      volumes:
      - name: rabbit-mq-data
        persistentVolumeClaim:
          claimName: rabbit-mq-data
</code></pre>

<p>Service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: rabbit-mq-service
  labels:
    app: rabbit-mq
  namespace: default
spec:
  type: ClusterIP
  ports:
  - port: 5672    
  selector:
   app: rabbit-mq
</code></pre>

<p>As I tested with other services and as it says in documentation, ClusterIP service should be visible to all pods and nodes inside cluster.
I need my RabbitMQ service to be accessible only inside cluster.
As I defined port 5672, same is used for targetPort.</p>

<p>I have .NET Core application connecting to service with following connection string: 
<code>amqp://user:password@10.100.10.10:5672/</code></p>

<p><code>kubectl get svc rabbit-mq-service</code>
<code>
NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
rabbit-mq-service   ClusterIP   10.100.10.10   &lt;none&gt;        5672/TCP   3h7m
</code></p>

<p>When I try to connect to RabbitMQ, I get the error:</p>

<p><code>Unhandled Exception: RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---&gt; System.AggregateException: One or more errors occurred. (Connection failed) ---&gt; RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---&gt; System.TimeoutException: The operation has timed out.</code></p>

<p>Have I misunderstood how ClusterIP service works?</p>

<p>Try this:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: rabbit-mq-service
  labels:
    app: rabbit-mq
  namespace: default
spec:
  type: ClusterIP
  clusterIP: None
  ports:
  - port: 5672    
  selector:
   app: rabbit-mq
</code></pre>

<p>and <code>amqp://user:password@rabbit-mq-service:5672/</code></p>
