DEV Community

Anil Kumar
Anil Kumar

Posted on

๐ŸŒŸ Unlocking Kubernetes Ingress: The Gateway to Simplified Traffic Management ๐ŸŒŸ

Hey Cloudees โ˜๏ธ!

Image description

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 ๐Ÿ’ญ

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay