I deployed my app using kubernetes and now Id like to add custom domain to the app. I am using this tutorial and it uses ingress to set the custom domain.
I noticed that the app load balancer has an ip. Why shouldn't I use that ip? What is the reason I need ingress?
Using domains over IPs has it's obvious advantages of not having to memorize 158.21.72.879 instead of mydomain.com.
Next, using mydomain.com, you can change your IP as many times as you like without having to change your calls to mydomain.com.
Ingress
comes in different flavors, is highly configurable, allows for traffic redirection using kubernetes service names and some of them even have their own stats page so you can monitor your requests.
Furthermore, if you are using gcloud or the like, the LoadBalancer
IP could change (unless confiugred otherwise), assigning you any available IP from your IP pool.
The real question is - why NOT use an Ingress
?
If you want to expose your app, you could just as easily use a service of type NodePort
instead of an Ingress. You could also use the type LoadBalancer
. LoadBalancer
is a superset of NodePort
and assigns a fixed ip. With the type LoadBalancer
you could assign a domain to this fixed IP. How to do this depends on where you have registered your domain.
To answer your questions:
NodePort
service or LoadBalander
service.LoadBalancer
serviceIf you just want to try out your app, you could just use the IP. A domain can be assigned later.
Here is a official kubernetes tutorial on how to expose an app: https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/