<p>I was trying to connect 2 microservices via nats which worked out pretty well in local environment, i used docker image of NATS and used its pub-sub model. But now my task is to connect those 2 microservices inside kubernetes cluster.
I made docker images of those microservices but can't figure out how to connect them via the container image of NATS.</p>

<p>docker image of NATS - <a href="https://hub.docker.com/_/nats" rel="nofollow noreferrer">https://hub.docker.com/_/nats</a></p>

Kanishk Khandelwal
<p>To communicate two pods in kubernetes you have to expose them using a service.
If you dont want to expose them to outside the cluster you can use ClusterIP as service type.</p>

<p>You can see here all the documentation about services in kubernetes.</p>

<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>
