Hey Cloudees βοΈ!
Managing application traffic in Kubernetes can be challenging, especially when have multiple services running. That's where π²πππππππππ π°ππππππ comes into play!
Before getting into K8S Ingress first let's understand What is Layer 4 and Layer 7 Load Balancing.
πππ²ππ«π:
π Operates at Transport layer of Operating System(TCP/UDP). It make decisions based on the available information in this transport layer.
π It Doesn't have intelligence to transport based on the request.
π Requires separate SSL Termination.
Ex: K8S Load Balancer
πππ²ππ«π:
π It Operates at Application level, it makes decisions based on application requests like http/https.
π It has the intelligence to distribute the load based on the application requests ( ex: /login, /admin .. etc)
π It can terminate SSL connections
Ex: K8S Ingress, AWS LoadBalancer, Azure Application Gateway..
πΎππππππ π°ππππππ:
π We cannot Expose our application externally by using clusterIP service.
π Exposing the app via NodePort can be a security Concern.
π Exposing app via LoadBalancer is much expensive and it will point only app/one service at a time.
To checkmate all these there is a concept called " Ingress "
πΎπππ ππ π°ππππππ? :
Ingress is an API object in K8S that manages external HTTP/HTTPS access to services running in the K8S cluster.
π It is a Layer7 load balancer.
π It acts as an entry point to the K8S cluster.
π It allows to define rules for routing incoming requests to the appropriate Services based on the URL path's / Host names.
It has 2 components:
β¨ Ingress Controller
β¨ Ingress Resources
π π°ππππππ πͺπππππππππ:
It is a K8S object, While Ingress defines the routing rules, Ingress Controller watches for these rules and performs the routing.
π π°ππππππ πΉππππππππ:
It is a K8S object where we define the routing rules like how the load balancing should be done.
π°ππππππ π¨πππππππππππ:
After we create an Ingress resource in K8S. A Cloud provider LoadBalancing URL/IP will be assigned to access.
π When users trying to access the application using LoadBalancing URL/IP address the traffic will first hit the Ingress controller
π The Ingress Controller always watches the Ingress Resource rules/ for any modifications.
π Based on the rules it will pass the request to the specific pod/Deployment service(ClusterIP).
π Through internal communication the ClusterIP service will pass the request to the respective pod and the pod will carry forward the request.
Workflow:
User -> Cloud provider LoadBalancer -> Ingress Controller -> Service( ClusterIP) -> Pod.
Note:
π Here we need Service for each Deployment or Pod
Do comment down your thoughts π