I am a kubernetes newbie, and no matter how much I read about it I cannot get my head around this issue.
I have a simple deployment , which is creating a pod with a not so complex app.
I know what an ingress and an ingress controller is doing ,but as far as I understand it is not required for me to expose my pod-app externally.
Only a LoadBalancer service should be enough.
I do not have need of more than one rule for traffic routing.
Am I wrong about that?

- 309
- 3
- 6
- 17
3 Answers
Traditionally, you would create a LoadBalancer service for each service you want to expose externally. This can get rather expensive. Ingress gives you a way to route requests to services based on the request host or path, centralizing a number of services into a single entrypoint.
Also load balancer provisioning takes time and works only in supported cloud providers such as AWS, GCP etc.
One more thing to consider is the need of L4(TCP/UDP) layer routing because kubernetes Ingress API is primarily L7 layer but some of the ingress controllers such as traefik, nginx supports L4 layer(TCP/UDP) along with L7 layer(HTTP) routing.
So answer to your question is it depends based on your environment and use cases.

- 41,002
- 9
- 78
- 107
-
Ingress routes can also be added instantly, whereas LoadBalancer provisioning depends on your specific cloud vendor and can sometimes take up to a minute. – Frank Yucheng Gu Feb 13 '20 at 15:22
-
Thank you for your answer. In my case I have deployed a python web app that returns some results from an influx database that it is also deployed at the same kubernetes cluster. I use a LoadBalancer which allowes me to have external access to the database by using the external-ip and the port. I want something similar for my python app pod. They are all deployed to AWS , but I cannot figure out how to do that with my python webapp service. – Flora Biletsiou Feb 13 '20 at 16:00
-
You can get an ALB for your python app and here is an example of using AWS ALB ingress controller https://github.com/kubernetes-sigs/aws-alb-ingress-controller/tree/master/docs/examples/echoservice – Arghya Sadhu Feb 13 '20 at 16:06
Ingress and IngressControllers are used for traffic routing at layer 7 i.e., if your backends talk L7 protocols like HTTP, GRPC etc. You can route requests based on request path to different backend services using Ingress.
If your app doesn't operate at Layer 7, you might not need an Ingress.
Another question you could ask yourself if your migrating your app from non-kubernetes environment to kuberneters is - are you using a reverse proxy like nginx already? If so, you might want to use Ingress. I say might because it is not necessary. You can achieve the same affect of using an Ingress by running the nginx container as a pod, writing the nginx.conf yourself and making it available externally(using a LoadBalancer service for example). Instead by using IngressController you need not maintain the nginx pod or write nginx.conf. You can instead express the same configuration as
Ingress
resource which is much simpler.

- 10,007
- 2
- 25
- 41
Ingress is needed if you want to expose your service to external. Especially for layer 7 in OSI model (HTTP transport). Ingress also provide the mechanism to enable TLS support in your load balancer. Traffic routing is controlled by rules defined on the Ingress resource. An Ingress can be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name based virtual hosting. An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic.
By default Ingress controller depends on which kind of cloud provider you're using, or if you're using on premise you'll need to set it up based on what you need. In one cluster, you can create multiple Ingress controller as well. There's many kinds of Ingress controller, you can take a look on this article.
I think this article about Load Balancer and Ingress may also help.

- 1,865
- 2
- 16
- 20