What Is Ingress Controller in Kubernetes: Simple Explanation
ingress controller in Kubernetes is a component that manages external access to services inside a cluster, usually HTTP and HTTPS traffic. It listens for Ingress resource rules and routes incoming requests to the right service based on those rules.How It Works
Think of an ingress controller as a smart traffic manager at the entrance of a gated community. It watches the incoming cars (requests) and directs each one to the correct house (service) based on the address (rules) it has.
In Kubernetes, you define Ingress resources that specify rules like which URL path or domain should go to which service inside the cluster. The ingress controller reads these rules and configures itself to route the traffic accordingly.
This way, you can expose multiple services through a single external IP or domain, and the ingress controller handles the routing, SSL termination, and load balancing behind the scenes.
Example
This example shows a simple ingress resource that routes traffic to two services based on the URL path.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
spec:
rules:
- host: example.com
http:
paths:
- path: /app1
pathType: Prefix
backend:
service:
name: app1-service
port:
number: 80
- path: /app2
pathType: Prefix
backend:
service:
name: app2-service
port:
number: 80
When to Use
Use an ingress controller when you want to expose multiple Kubernetes services through a single external IP or domain name. It simplifies managing access by centralizing routing rules.
Common real-world uses include:
- Hosting multiple web applications on different paths or subdomains.
- Terminating SSL/TLS certificates at the ingress level to secure traffic.
- Load balancing traffic to services based on URL or host headers.
- Applying authentication or rate limiting at the entry point.
Key Points
- An ingress controller routes external HTTP/HTTPS traffic to internal services.
- It uses
Ingressresource rules to decide routing. - Allows multiple services to share one external IP or domain.
- Supports SSL termination and load balancing.
- Common ingress controllers include NGINX, Traefik, and HAProxy.