0
0
KubernetesConceptBeginner · 3 min read

What Is Ingress Controller in Kubernetes: Simple Explanation

An 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.

yaml
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
Output
Ingress resource 'example-ingress' created routing /app1 to 'app1-service' and /app2 to 'app2-service'.
🎯

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 Ingress resource 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.

Key Takeaways

An ingress controller manages external HTTP/HTTPS access to Kubernetes services using Ingress rules.
It routes traffic based on hostnames and paths to the correct service inside the cluster.
Ingress controllers enable sharing one external IP for multiple services and handle SSL termination.
Use ingress controllers to simplify exposing and securing multiple applications in Kubernetes.