<p>I was using minikube, and when I created a load balancer it would always give me a diferent ip in the external endpoint, and I was able to access my app.</p>
<p>But now, I changed to docker kubernetes, and when I create a load balancer, it always add the <code>localhost:8181</code> at the external endpoints.</p>
<p>here is my yaml:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: app1
  labels:
    app: app1
spec:
  #externalIPs:
  #  - 172.29.0.0
  ports:
  - protocol: TCP
    name: http
    port: 8181
    targetPort: 8181
  type: LoadBalancer
  selector:
    app: app1
</code></pre>
<p>its the same as : <code>kubectl expose deployment app1 --port=8181 --target-port=8181 --name=app1 --type=LoadBalancer</code></p>
<p>as you can see, I tried to add externalIPs, when I do that, both localhost and the externalIP appear in the dashboard, but using the externalIP doesn't work...</p>
<p>I would like it to generate an ip when I create a loadbalancer so I can access my app from there, like I did with minikube.</p>
<p>thanks for your time.</p>

<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">Official documentation</a> says that:</p>
<blockquote>
<p>Type values and their behaviors are:
LoadBalancer: Exposes the Service externally using a cloud provider's load balancer. NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.</p>
</blockquote>
<p>that is why with Kubernetes you have to have a cloud provider enabled (otherwise no External IP would be provisioned):</p>
<pre><code>$ kubectl get svc
NAME                     TYPE           CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
app1                     LoadBalancer   10.0.2.46     &lt;pending&gt;     8181:30257/TCP   18s
</code></pre>
<p>While in minikube it is provisioned for you with the <code>minikube service &lt;service_name&gt;</code>:</p>
<pre><code>$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
app1         LoadBalancer   10.103.51.13   &lt;pending&gt;     8181:30129/TCP   68s

$ minikube service app1
|-----------|------|-------------|-----------------------------|
| NAMESPACE | NAME | TARGET PORT |             URL             |
|-----------|------|-------------|-----------------------------|
| default   | app1 | http/8181   | http://192.168.99.100:30129 |
|-----------|------|-------------|-----------------------------|

</code></pre>
<blockquote>
<p>I would like it to generate an ip when I create a loadbalancer so I can access my app from there, like I did with minikube.</p>
</blockquote>
<p>There is <a href="http://alesnosek.com/blog/2017/02/14/accessing-kubernetes-pods-from-outside-of-the-cluster/" rel="nofollow noreferrer">awesome post</a> by Ales Nosek on topic.</p>
<p>In short:</p>
<blockquote>
<p>In order to be able to create a service of type LoadBalancer, a cloud provider has to be enabled in the configuration of the Kubernetes cluster. As of version 1.6, Kubernetes can provision load balancers on AWS, Azure, CloudStack, GCE and OpenStack.</p>
</blockquote>
<p>It highly depends on what you'd like to achieve, but I believe that you may be interested in <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer"><code>Ingress</code></a>.</p>
