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.
But now, I changed to docker kubernetes, and when I create a load balancer, it always add the localhost:8181
at the external endpoints.
here is my yaml:
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
its the same as : kubectl expose deployment app1 --port=8181 --target-port=8181 --name=app1 --type=LoadBalancer
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...
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.
thanks for your time.
Official documentation says that:
that is why with Kubernetes you have to have a cloud provider enabled (otherwise no External IP would be provisioned):
While in minikube it is provisioned for you with the
minikube service <service_name>
:There is awesome post by Ales Nosek on topic.
In short:
It highly depends on what you'd like to achieve, but I believe that you may be interested in
Ingress
.