<p>I deployed a RabbitMQ server on my kubernetes cluster and i am able to access the management UI from the browser. But my spring boot app cannot connect to port 5672 and i get connection refused error. The same code works , if i replace my application.yml properties from kuberntes host to localhost and run a docker image on my machine.I am not sure what i am doing wrong?</p>

<p>Has anyone tried this kind of setup.
Please help. Thanks!</p>

<p>Let's say the dns is named <code>rabbitmq</code>. If you want to reach it, then you have to make sure that rabbitmq's deployment has a service attached with the correct ports for exposure. So you would target <code>http://rabbitmq:5672</code>.</p>

<p>To make sure this or something alike exists you can debug k8s services. Run <code>kubectl get services | grep rabbitmq</code> to make sure the service exists. If it does, then get the service yaml by running 'kubectl get service rabbitmq-service-name -o yaml'. Finally, check <code>spec.ports[]</code> for the ports that allow you to connect to the pod. Search for '5672' in <code>spec.ports[].port</code> for amqp. In some cases, the port might have been changed. This means <code>spec.ports[].port</code> might be 3030 for instance, but <code>spec.ports[].targetPort</code> be 5672.</p>
