Introduction
When working with Kubernetes, exposing your applications to the outside world is an important task. By default, Kubernetes provides services like ClusterIP, NodePort, and LoadBalancer, but they are not always flexible or cost-effective for real-world production systems.
This is where the Ingress Controller in Kubernetes comes into play. It helps you manage external access to your services in a smart and centralized way using routing rules.
In this article, we will understand what an Ingress Controller is, why it is used, and how to configure it step by step with a real example using simple words and practical explanations.
What is Ingress in Kubernetes?
Ingress in Kubernetes is an API object that manages external HTTP and HTTPS access to services inside a cluster.
Instead of exposing multiple services separately, Ingress allows you to define rules for routing traffic to different services based on:
URL paths
Domain names
Hostnames
It acts like a smart router sitting at the entry point of your Kubernetes cluster.
What is an Ingress Controller?
An Ingress Controller is a component that actually implements the rules defined in the Ingress resource.
Important point:
Ingress is just a configuration
Ingress Controller is the actual engine that processes traffic
Without an Ingress Controller, Ingress rules will not work.
Popular Ingress Controllers:
NGINX Ingress Controller
Traefik
HAProxy
In this article, we will use NGINX Ingress Controller as it is the most commonly used.
Why Use Ingress Controller in Kubernetes?
Using an Ingress Controller provides several benefits:
Centralized routing for multiple services
Supports domain-based routing
Reduces cloud load balancer costs
Enables SSL/TLS termination
Improves scalability and flexibility
Step 1: Install NGINX Ingress Controller
First, you need to install the NGINX Ingress Controller in your Kubernetes cluster.
Using kubectl:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
This command installs all required components like:
Controller Pod
Service
Configurations
To verify installation:
kubectl get pods -n ingress-nginx
Step 2: Create a Sample Deployment
Now, create a simple application deployment.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 2
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: nginx
ports:
- containerPort: 80
Join the conversation! Your thoughts help the community grow.