Kubernetes 101 : Ingress controller and Ingress rules

A clusterIP service is an internal service only accessible from inside the kubernetes cluster.

To expose our services to the outside, we can create a clusterIP service, and have an Ingress controller that could be accessed from the outside point to it.
An Ingress controller read the ingress rules from a Yaml file and forwards the HTTP traffic based on these rules.

Below is the clusterIP service "web-service
 for the pods with the "web-info" label:

Below is the clusterIP service "web-info" for the pods with the "web-info" label:

Below are the rules for our Ingress controller that include the above services "web-service" and "web-info":


We will need to map the "hostname.com" to an IP address in the "/etc/hosts" file for it to be accessible.
- "hostname.com"  is the entry-point to our kubernetes cluster

Below is our diagram (according to the above Yaml file):
  • Requests to  "hostname.com" go to the "web-service" pods.
  • Requests to "hostname.com/info" go to the "web-info" pods.

Ingress controllers:

We could install one of these Ingress controller in our kubernetes cluster (nginx, traefik, ...)

The Ingress controller can run as a pod in the kubernetes cluster or we could deploy it as daemonSet if we want it to run on all the nodes of the cluster.

As we can see in the above diagram, we could use a cloud-based load-balancer that would forward traffic to our Ingress controller.


Leave as a comment: