<p>I have a separate VM in the same network as my kubernetes in Azure.
I have a kafka pod and I am able to reach this pod using the IP. The problem is that the pod IP is changing all the time.</p>
<p>Is there any way to get the correct IP each time the pod IP is changing?</p>

NoamiA
<p>As mentioned by @arghya-sadhu already going for Kubernetes service, is the best option. The kubernetes service has an IP depending on the type of kubernetes service.</p>
<ul>
<li>For services of type <code>ClusterIP</code>, you get a cluster IP address</li>
<li>For services of type <code>Load Balancer</code>, you get a Loadbalancer IP address (i.e) public IP address</li>
<li>For services of type <code>NodePort</code>, you can access using the node's address.</li>
</ul>
<p>But, whatever the type of service is, you can access the service using the kube-DNS within the cluster. So, let's say your service name is <code>other-service</code> and it exposes port <code>8080</code>, running on namespace <code>abc</code>, then you can access the service as follows:</p>
<blockquote>
<p><a href="http://other-service.abc:8080" rel="nofollow noreferrer">http://other-service.abc:8080</a></p>
</blockquote>
<p>Since, your VM runs outside the cluster, it is better to use Loadbalancer and access the pod using Loadbalancer url or IP address. You can set an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">ingress</a> in case there are multiple pods in the cluster that you want to connect to.</p>
