<p>I'm creating an App that will have to communicate with a Kubernetes service, via REST APIs. The service hosts a docker image that's listening on port 8080 and responds with a JSON body. </p>

<p>I noticed that when I create a deployment via -</p>

<pre><code>kubectl expose deployment myapp --target-port=8080 --type=NodePort --name=app-service
</code></pre>

<p>It then creates a service entitled <em>app-service</em></p>

<p>To then locally test this, I obtain the IP:port for the created service via - </p>

<pre><code>minikube service app-service --url
</code></pre>

<p>I'm using minikube for my local development efforts. I then get a response such as <a href="http://172.17.118.68:31970/" rel="nofollow noreferrer">http://172.17.118.68:31970/</a> which then when I enter on my browser, works fine (I get the JSON responses i'm expecting).</p>

<p>However, it seems the IP &amp; port for that service are always different whenever I start this service up.</p>

<p>Which leads to my question - how is a mobile App supposed to find that new IP:Port then if it's subject to change? Is the common way to work around this to register that combination via a DNS server (such as Google Cloud's DNS system?)</p>

<p>Or am I missing a step here with setting up Kubernetes public services?</p>

Daltrey Waters
<blockquote>
  <p>Which leads to my question - how is a mobile App supposed to find that new IP:Port then if it's subject to change? </p>
</blockquote>

<p><code>minikube</code> is not meant for production use. It is only meant for development purpose. You should create a real kubernetes cluster and use <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/" rel="nofollow noreferrer">LoadBalancer</a> type service or an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a>(for L7 traffic) to expose your service to external world. Since you need to expose your backend REST api, Ingress is good choice. </p>
