Configuring Ingress Controller for Application
Access in Kubernetes
Ingress Controller :-
In a Kubernetes cluster, an Ingress Controller is a component
responsible for routing external traffic to services running within the
cluster.It acts like a traffic manager, handling incoming HTTP or
HTTPS requests and sending them to the right service inside the
cluster based on rules defined in an Ingress resource, which tells it
how to route the traffic.
The Ingress Controller makes sure that requests from outside the
cluster are directed to the correct services inside, based on things
like the URL or host name.
Ajinkya Kale
Practical Implementation :
Step1 : Deploy the Ingress Controller (NGINX ingress controller)
Step2 : Check Pods in Ingress-NGINX Namespace
Step3 : Create and scale the httpd Deployment
Step4 : Exec into httpd Pods to Edit index.html
Once inside the pod, you can edit the index.html file and add some text
like (version 1, Version 2) in both pods to ensuring both pods display
the correct page with Round Robin load balancing strategy and running
as expected.
Ajinkya Kale
Step5 : Expose the httpd deployment as a service on port 80
Step6 : Configure Ingress Rule for Traffic Routing
Create an ingress rule to route incoming traffic to the HTTPD service
based on context (e.g., host, path). Then apply the rule:
Ajinkya Kale
Step7 : Check Services in Ingress-NGINX Namespace and Test the Setup
with Curl (Round Robin)
Test the service routing via the ingress controller, using the service’s
exposed port (e.g., 30918
Successfully configure Ingress Controller.!!
Ajinkya Kale
To access your application via a browser, you need to expose
the ingress controller using the NodePort service type.
In a cloud environment (like AWS, GCP, or Azure), a LoadBalancer type
service automatically provisions an external load balancer and assign public
IP addresses or external IP address and configures the load balancer for
you. However,
In an on-premises setup like Oracle VM, Kubernetes does not automatically
provision these external resources this automatic provisioning may not
happen.
To overcome from this issue we are changing the Ingress Service Type
LoadBalancer to NodePort.
Practical Inplementation :
Step1 : Edit the Ingress Controller Service
You need to change the service type of the ingress controller from
LoadBalancer to NodePort.
Step2 : Verify the assigned NodePort Service
Ajinkya Kale
Step3 : Access the Application via Browser
Now you can access your application by entering the following
URL in your browser:
http://<Worker_Node_Ip>:<Ingress_NodePort>/
Refresh the same page again.
Thank You!!!
Ajinkya Kale