Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes Ingress vs. Service with externalIPs

If I expose a (single) web service (say http://a.b.c.d or https://a.b.c.d) on a (small) Kubernetes 1.13 cluster, what is the benefit of using Ingress over a Service of type ClusterIP with externalIPs [ a.b.c.d ] alone?

The address a.b.c.d is routed to one of my cluster nodes. Ingress requires installing and maintaining an ingress controller, so I am wondering when this is justified.

like image 566
rookie099 Avatar asked Sep 17 '25 20:09

rookie099


2 Answers

In Kubernetes, a Service and an Ingress are both used to expose your application to the external world, but they operate at different layers of the networking stack and have different functionalities.

A Service is a Kubernetes resource that provides a stable IP address and DNS name for a set of Pods that provide the same functionality. It allows for load balancing traffic between the Pods, and also provides a way for one Pod to discover and communicate with another Pod using its stable DNS name or IP address. Services are used within the cluster to route traffic between internal components and can also be exposed to the outside world using a NodePort or LoadBalancer.

An Ingress, on the other hand, is a Kubernetes resource that provides a way to expose HTTP and HTTPS routes from outside the cluster to services within the cluster. It acts as a layer 7 (application layer) load balancer, routing incoming traffic based on the request's path or hostname. An Ingress is typically used for applications that require more advanced routing and traffic management capabilities, such as SSL termination, virtual hosting, and path-based routing.

In summary, a Service is used for internal traffic management within the cluster, while an Ingress is used to route external traffic into the cluster and to specific services based on advanced routing rules.

like image 96
Diego Velez Avatar answered Sep 19 '25 18:09

Diego Velez


  • Each service of type ClusterIP has its own public IP address, whereas an Ingress only requires single IP even if you want to provide access to dozens of services.
  • You can also forward the client requests to the corresponding service based on the host and path based routing provided by Ingress.
  • As Ingresses operate at layer 7 (application layer), it can also provide features like cookie-based session, which is not possible via services.
like image 26
Vikram Jakhar Avatar answered Sep 19 '25 19:09

Vikram Jakhar