Skip to content

IngressClass resource

An IngressClass is a Kubernetes resource used to classify Ingress controllers, allowing a cluster to host multiple Ingress implementations simultaneously^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md]. It effectively solves the conflict where different Ingress resources might require different controllers or configurations by acting as a router for Ingress requests^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md].

Function

In Kubernetes, the IngressClass resource serves as an intermediary mechanism. When an Ingress resource is created, it can specify an ingressClassName field^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md]. This field links the Ingress rule to a specific IngressClass, which in turn dictates which Ingress Controller (e.g., Nginx) should handle that particular traffic^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md].

This allows for a multi-controller environment within the same cluster. For instance, different applications can utilize different ingress controllers, and the IngressClass ensures that traffic is routed to the correct controller based on the Ingress object's class definition^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md].

Example Configuration

When deploying an ingress controller like Nginx, an IngressClass resource is typically created automatically. For example, the deployment manifest may generate a resource named ingressclass.networking.k8s.io/nginx^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md]. Users can then reference this class in their Ingress definitions using the --class=nginx flag or by specifying the class name in the resource configuration^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md].

Sources

^[400-devops__06-Kubernetes__k8s-learning__06.ingress__README.md]