Nextgen Blog
HomeLearnAIQuantumRoboticsSecuritySpaceAbout
Nextgen Blog

By Anubhav — full stack engineer, IIT Mandi CSE. Deep dives into AI, software engineering, and the technologies shaping the next generation of tech.

Navigate

  • Home
  • Learn
  • Blog
  • Archive
  • About

Topics

  • Artificial Intelligence
  • Quantum Computing
  • Robotics
  • Cybersecurity
  • Space Tech

Connect

Built with ❤️ & By - Anubhav

© 2026 Nextgen Blog by Anubhav. All rights reserved.

Privacy PolicyTerms of Service
Phase 03 · Networking & ScalingChapter 13 of 33
12.
Phase 03Read time ~13 minDifficulty intermediate

Ingress

Warrior, you've now learned Services, so you're ready for one of the most important concepts in real-world Kubernetes:

In this chapter
  • 01The Problem Ingress Solves
  • 02What Is Ingress?
  • 03Ingress vs Ingress Controller
  • 04Ingress
  • 05Ingress Controller
  • 06Simple Example
  • 07Understand This YAML
  • 08Path-Based Routing
  • 09Host-Based Routing
  • 10Path vs Host Routing
  • 11Path-based
  • 12Host-based
  • 13What Is pathType?
  • 14Exact
  • 15Prefix
  • 16ImplementationSpecific
  • 17Ingress + Service + Pods
  • 18Complete Example
  • 19Ingress Is Layer 7
  • 20Layer 4 vs Layer 7
  • 21Layer 4
  • 22Layer 7
  • 23HTTPS and TLS
  • 24What's secretName?
  • 25TLS Termination
  • 26DNS Is Also Required
  • 27Complete Real-World Flow
  • 28Ingress Controller
  • 29Popular Ingress Implementations
  • 30NGINX Ingress Controller
  • 31Traefik
  • 32Cloud-specific controllers
  • 33Ingress vs LoadBalancer
  • 34LoadBalancer Service
  • 35Ingress
  • 36Why Not Just Use LoadBalancer Services?
  • 37Ingress Annotations
  • 38Ingress Is Not a Firewall
  • 39Ingress vs API Gateway
  • 40A Real Next.js + Node.js Architecture
  • 41Practical Exercise
  • 42Important Local Kubernetes Note
  • 43Troubleshooting Ingress
  • 44Step 1 — Check Ingress
  • 45Step 2 — Describe
  • 46Step 3 — Check Controller
  • 47Step 4 — Check Services
  • 48Step 5 — Check Endpoints
  • 49Step 6 — Check Pods
  • 50Step 7 — Check application logs
  • 51Common Ingress Problems
  • 52Problem 1 — No Ingress Controller
  • 53Problem 2 — Wrong Service Name
  • 54Problem 3 — Wrong Service Port
  • 55Problem 4 — Service Has No Endpoints
  • 56Problem 5 — DNS Isn't Configured
  • 57Ingress Interview Questions
  • 58Q1. What is Ingress?
  • 59Q2. What is an Ingress Controller?
  • 60Q3. Does Ingress directly route to Pods?
  • 61Q4. What is host-based routing?
  • 62Q5. What is path-based routing?
  • 63Q6. What is TLS termination?
  • 64Q7. Is Ingress a Service?
  • 65Q8. Does creating an Ingress automatically create a controller?
  • 66One-line memory trick
  • 67Next → Chapter 13: Resource Requests & Limits
In this chapter (67 sections)
01The Problem Ingress Solves02What Is Ingress?03Ingress vs Ingress Controller04Ingress05Ingress Controller06Simple Example07Understand This YAML08Path-Based Routing09Host-Based Routing10Path vs Host Routing11Path-based12Host-based13What Is pathType?14Exact15Prefix16ImplementationSpecific17Ingress + Service + Pods18Complete Example19Ingress Is Layer 720Layer 4 vs Layer 721Layer 422Layer 723HTTPS and TLS24What's secretName?25TLS Termination26DNS Is Also Required27Complete Real-World Flow28Ingress Controller29Popular Ingress Implementations30NGINX Ingress Controller31Traefik32Cloud-specific controllers33Ingress vs LoadBalancer34LoadBalancer Service35Ingress36Why Not Just Use LoadBalancer Services?37Ingress Annotations38Ingress Is Not a Firewall39Ingress vs API Gateway40A Real Next.js + Node.js Architecture41Practical Exercise42Important Local Kubernetes Note43Troubleshooting Ingress44Step 1 — Check Ingress45Step 2 — Describe46Step 3 — Check Controller47Step 4 — Check Services48Step 5 — Check Endpoints49Step 6 — Check Pods50Step 7 — Check application logs51Common Ingress Problems52Problem 1 — No Ingress Controller53Problem 2 — Wrong Service Name54Problem 3 — Wrong Service Port55Problem 4 — Service Has No Endpoints56Problem 5 — DNS Isn't Configured57Ingress Interview Questions58Q1. What is Ingress?59Q2. What is an Ingress Controller?60Q3. Does Ingress directly route to Pods?61Q4. What is host-based routing?62Q5. What is path-based routing?63Q6. What is TLS termination?64Q7. Is Ingress a Service?65Q8. Does creating an Ingress automatically create a controller?66One-line memory trick67Next → Chapter 13: Resource Requests & Limits

Ingress = HTTP/HTTPS entry point and routing layer for applications inside a Kubernetes cluster.

We'll build this mental model:

                         INTERNET
                            │
                            ▼
                    ┌──────────────┐
                    │ Load Balancer│
                    └──────┬───────┘
                           │
                           ▼
                    ┌──────────────┐
                    │    Ingress   │
                    └──────┬───────┘
                           │
              ┌────────────┼────────────┐
              │            │            │
              ▼            ▼            ▼
        frontend-svc   backend-svc   admin-svc
              │            │            │
             Pods         Pods         Pods

1. The Problem Ingress Solves#

Imagine your application has:

Next.js frontend
Node.js API
Admin application

You have:

frontend-service
backend-service
admin-service

Without an HTTP routing layer, you could expose them separately:

frontend → LoadBalancer
backend  → LoadBalancer
admin    → LoadBalancer

That can become expensive and unnecessarily complicated.

Instead, we want:

example.com
      │
      ▼
   Ingress
   /  |  \
  /   |   \
 ▼    ▼    ▼
FE   API  Admin

2. What Is Ingress?#

An Ingress is a Kubernetes API object containing rules for routing HTTP/HTTPS traffic to Services.

For example:

example.com/
        ↓
frontend-service
 
example.com/api
        ↓
backend-service
 
admin.example.com
        ↓
admin-service

So:

Ingress defines HTTP/HTTPS routing rules.

But there's an important distinction.


3. Ingress vs Ingress Controller#

This is a very common interview question.

Ingress#

The Kubernetes object containing rules.

kind: Ingress

Ingress Controller#

The actual software that reads those rules and handles traffic.

Examples include:

NGINX Ingress Controller
Traefik
HAProxy
AWS Load Balancer Controller

Conceptually:

Ingress YAML
     │
     ▼
Ingress Controller
     │
     ▼
Actual HTTP traffic

An Ingress object by itself doesn't magically route traffic.

You need an Ingress Controller or another implementation that supports the Ingress API.


4. Simple Example#

Suppose:

frontend-service → frontend Pods
 
backend-service → backend Pods

We want:

example.com/
    ↓
frontend-service
 
example.com/api
    ↓
backend-service

Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
 
metadata:
  name: app-ingress
 
spec:
  rules:
    - host: example.com
 
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: frontend-service
                port:
                  number: 80
 
          - path: /api
            pathType: Prefix
            backend:
              service:
                name: backend-service
                port:
                  number: 80

5. Understand This YAML#

The first rule:

host: example.com

means:

Request hostname:
example.com

Then:

path: /

means traffic for the root path goes to:

frontend-service

And:

path: /api

goes to:

backend-service

So:

https://example.com/
        ↓
frontend-service

while:

https://example.com/api/users
        ↓
backend-service

6. Path-Based Routing#

This is called:

Path-based routing

Example:

example.com/
     ↓
Frontend
 
example.com/api
     ↓
Backend
 
example.com/admin
     ↓
Admin

Architecture:

                    example.com
                         │
                         ▼
                      Ingress
                         │
          ┌──────────────┼──────────────┐
          │              │              │
          ▼              ▼              ▼
          /             /api          /admin
          │              │              │
          ▼              ▼              ▼
      Frontend         Backend         Admin
       Service         Service        Service

7. Host-Based Routing#

You can also route based on domain/subdomain.

For example:

example.com
    ↓
frontend-service
 
api.example.com
    ↓
backend-service
 
admin.example.com
    ↓
admin-service

Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
 
metadata:
  name: app-ingress
 
spec:
  rules:
 
    - host: example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: frontend-service
                port:
                  number: 80
 
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: backend-service
                port:
                  number: 80
 
    - host: admin.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: admin-service
                port:
                  number: 80

Now:

example.com
      ↓
Frontend
 
api.example.com
      ↓
Backend
 
admin.example.com
      ↓
Admin

8. Path vs Host Routing#

Path-based#

example.com/
example.com/api
example.com/admin

Host-based#

example.com
api.example.com
admin.example.com

You can also combine them.

For example:

api.example.com/v1
        ↓
API v1
 
api.example.com/v2
        ↓
API v2

9. What Is pathType?#

You'll commonly see:

pathType: Prefix

There are three Kubernetes path types:

Exact
Prefix
ImplementationSpecific

Exact#

path: /api
pathType: Exact

Matches:

/api

but not necessarily:

/api/users

Prefix#

path: /api
pathType: Prefix

Matches paths under:

/api
/api/users
/api/products
/api/orders/123

This is commonly useful for APIs.


ImplementationSpecific#

The interpretation depends on the Ingress Controller.

For beginners, prefer understanding:

Exact
Prefix

first.


10. Ingress + Service + Pods#

This is critical.

Ingress normally does not directly select Pods.

The flow is:

Ingress
   ↓
Service
   ↓
Pods

Example:

Internet
   ↓
Ingress
   ↓
backend-service
   ↓
Pod

So you should not think:

Ingress → Pod

Think:

Ingress → Service → Pod

11. Complete Example#

Suppose you have:

frontend-service
backend-service

and:

frontend Pods
backend Pods

Architecture:

                         INTERNET
                            │
                            ▼
                       Ingress
                      /        \
                     /          \
                    ▼            ▼
          frontend-service   backend-service
                  │                │
             ┌────┼────┐      ┌────┼────┐
             ▼    ▼    ▼      ▼    ▼    ▼
            Pod  Pod  Pod     Pod  Pod  Pod

12. Ingress Is Layer 7#

Ingress generally operates at:

HTTP/HTTPS application layer (Layer 7).

That's why it can understand things like:

Host
Path
HTTP method
TLS
HTTP headers

For example:

/api/users

can be routed differently from:

/admin

A basic TCP load balancer doesn't inherently make decisions based on HTTP URL paths in the same way.


13. Layer 4 vs Layer 7#

Layer 4#

Transport-level:

TCP
UDP

Example:

IP:Port

Layer 7#

Application-level:

HTTP
HTTPS

Example:

Host: api.example.com
Path: /users

Ingress is primarily about HTTP/HTTPS routing.


14. HTTPS and TLS#

Production applications should use:

HTTPS

instead of plain:

HTTP

Traffic:

Browser
   │
   │ HTTPS
   ▼
Ingress
   │
   │ HTTP/internal HTTPS depending on setup
   ▼
Service
   ▼
Pods

Ingress can be configured with TLS certificates.

Example:

apiVersion: networking.k8s.io/v1
kind: Ingress
 
metadata:
  name: app-ingress
 
spec:
  tls:
    - hosts:
        - example.com
      secretName: example-tls
 
  rules:
    - host: example.com
 
      http:
        paths:
          - path: /
            pathType: Prefix
 
            backend:
              service:
                name: frontend-service
                port:
                  number: 80

15. What's secretName?#

Here:

secretName: example-tls

Kubernetes references a Secret containing TLS certificate information.

Conceptually:

TLS Secret
   │
   ├── Certificate
   └── Private Key

The Ingress Controller uses it to terminate TLS.


16. TLS Termination#

Suppose:

Browser
   │
   │ HTTPS
   ▼
Ingress

Ingress decrypts the HTTPS traffic.

Then internally:

Ingress
   │
   │ HTTP
   ▼
Service
   │
   ▼
Pod

This is called:

TLS termination at the Ingress layer.

You can also configure encryption from Ingress onward when required.


17. DNS Is Also Required#

Suppose your domain is:

example.com

You need DNS to resolve it to the external entry point.

Conceptually:

example.com
      │
      ▼
DNS
      │
      ▼
Load Balancer IP / hostname
      │
      ▼
Ingress

So Kubernetes Ingress doesn't magically create your domain registration.

You still need appropriate DNS configuration.


18. Complete Real-World Flow#

Imagine you type:

https://api.example.com/users

The request might travel:

Browser
   │
   │ HTTPS
   ▼
DNS
   │
   ▼
Cloud Load Balancer
   │
   ▼
Ingress Controller
   │
   │ host = api.example.com
   │ path = /users
   ▼
backend-service
   │
   ▼
backend Pod
   │
   ▼
Node.js

This is the flow you should be able to explain in an interview.


19. Ingress Controller#

Let's make the distinction crystal clear.

You create:

kind: Ingress

But Kubernetes needs something actually processing that configuration.

For example:

Ingress Resource
      │
      ▼
NGINX Ingress Controller
      │
      ▼
Traffic

The controller watches the Kubernetes API for Ingress resources and configures its traffic-routing behavior accordingly.


20. Popular Ingress Implementations#

Examples:

NGINX Ingress Controller#

Widely used Kubernetes ingress implementation.

Traefik#

Popular reverse proxy / ingress solution.

Cloud-specific controllers#

For example, cloud providers may offer controllers that integrate Kubernetes routing with their native load-balancing systems.

The exact choice depends on your platform and architecture.


21. Ingress vs LoadBalancer#

This confuses many beginners.

LoadBalancer Service#

Internet
   ↓
Cloud Load Balancer
   ↓
Service
   ↓
Pods

Ingress#

Internet
   ↓
Load Balancer
   ↓
Ingress Controller
   ↓
Service
   ↓
Pods

Ingress gives you HTTP-aware routing.


22. Why Not Just Use LoadBalancer Services?#

Suppose you have:

frontend
backend
admin
payments

Using separate LoadBalancer Services:

4 applications
↓
4 external load balancers

Ingress can potentially provide:

1 external entry point
        ↓
Ingress
   ┌────┼────┬────┐
   ▼    ▼    ▼    ▼
 FE    API  Admin Payments

This can simplify routing and infrastructure, although exact cost and architecture depend on the cloud provider and controller.


23. Ingress Annotations#

Ingress Controllers often support additional configuration through annotations.

For example, depending on the controller:

metadata:
  annotations:
    ...

Possible features include:

URL rewriting
Rate limiting
Authentication
Redirects
Timeouts
Request size limits
Security settings

But:

Annotations are controller-specific.

Don't assume an annotation supported by NGINX will work with every other Ingress Controller.


24. Ingress Is Not a Firewall#

Another important distinction.

Ingress handles application routing.

Security can involve:

Cloud firewall
NetworkPolicy
Security Groups
WAF
RBAC
Authentication
TLS

Don't think:

Ingress = complete security layer

It isn't.


25. Ingress vs API Gateway#

These concepts overlap but aren't identical.

An API Gateway can provide capabilities such as:

Authentication
Authorization
Rate limiting
API keys
Analytics
Transformation
Caching
Routing

Ingress primarily provides HTTP routing into Kubernetes, although specific controllers/gateways can provide additional features.

In modern Kubernetes ecosystems, Gateway API is also increasingly important and provides a more expressive routing model than the original Ingress API.

We'll focus on Ingress first because it's foundational.


26. A Real Next.js + Node.js Architecture#

Since you work heavily with Next.js and Node.js, imagine this:

                       INTERNET
                           │
                           ▼
                  ┌────────────────┐
                  │ Load Balancer  │
                  └───────┬────────┘
                          │
                          ▼
                    ┌───────────┐
                    │  Ingress  │
                    └─────┬─────┘
                          │
             ┌────────────┼────────────┐
             │                         │
        example.com              api.example.com
             │                         │
             ▼                         ▼
    nextjs-service              node-api-service
             │                         │
       ┌─────┼─────┐             ┌─────┼─────┐
       ▼     ▼     ▼             ▼     ▼     ▼
      Pod   Pod   Pod            Pod   Pod   Pod
                                      │
                                      ▼
                               postgres-service
                                      │
                                      ▼
                                PostgreSQL

This is very close to the type of architecture you'll encounter in real projects.


27. Practical Exercise#

Assume you already have:

frontend-service
backend-service

Create:

apiVersion: networking.k8s.io/v1
kind: Ingress
 
metadata:
  name: app-ingress
 
spec:
  rules:
    - host: myapp.local
 
      http:
        paths:
          - path: /
            pathType: Prefix
 
            backend:
              service:
                name: frontend-service
                port:
                  number: 80
 
          - path: /api
            pathType: Prefix
 
            backend:
              service:
                name: backend-service
                port:
                  number: 80

Apply:

kubectl apply -f ingress.yaml

Check:

kubectl get ingress

More details:

kubectl describe ingress app-ingress

28. Important Local Kubernetes Note#

If you're using:

Minikube
Kind
Docker Desktop Kubernetes

Ingress setup varies.

For example, Minikube commonly provides an ingress addon:

minikube addons enable ingress

Then:

kubectl get pods -n ingress-nginx

may show the controller.

Don't assume every Kubernetes cluster has an Ingress Controller installed by default.


29. Troubleshooting Ingress#

When:

https://example.com

doesn't work, don't randomly change YAML.

Follow the path.

Step 1 — Check Ingress#

kubectl get ingress

Step 2 — Describe#

kubectl describe ingress app-ingress

Step 3 — Check Controller#

Depending on the controller:

kubectl get pods -A

Step 4 — Check Services#

kubectl get svc

Step 5 — Check Endpoints#

kubectl get endpointslices

Step 6 — Check Pods#

kubectl get pods -o wide

Step 7 — Check application logs#

kubectl logs <pod-name>

The request path is:

DNS
 ↓
Load Balancer
 ↓
Ingress Controller
 ↓
Service
 ↓
Pod
 ↓
Application

Find where it breaks.


30. Common Ingress Problems#

Problem 1 — No Ingress Controller#

You create:

kind: Ingress

but nothing is actually processing it.

Result:

Ingress exists
but traffic doesn't work

Problem 2 — Wrong Service Name#

Ingress:

name: backend-service

but actual Service:

backend

Traffic won't reach the intended backend.


Problem 3 — Wrong Service Port#

Ingress points to:

Service port 80

but the actual Service doesn't expose that port.


Problem 4 — Service Has No Endpoints#

Service selector doesn't match Pod labels.

Service selector
      ≠
Pod labels

Problem 5 — DNS Isn't Configured#

Your Ingress might be perfectly configured, but:

api.example.com

doesn't resolve to your external entry point.

Then the problem is DNS, not Kubernetes routing.


31. Ingress Interview Questions#

Q1. What is Ingress?#

Ingress is a Kubernetes API resource that defines HTTP/HTTPS routing rules for directing external traffic to Services.

Q2. What is an Ingress Controller?#

Software that watches Ingress resources and implements their routing behavior.

Q3. Does Ingress directly route to Pods?#

Normally:

Ingress
 ↓
Service
 ↓
Pods

Q4. What is host-based routing?#

Routing based on hostname:

api.example.com → backend
admin.example.com → admin

Q5. What is path-based routing?#

Routing based on URL path:

example.com/ → frontend
example.com/api → backend

Q6. What is TLS termination?#

HTTPS is decrypted at the Ingress/load-balancing layer before traffic is forwarded internally.

Q7. Is Ingress a Service?#

No.

Ingress and Service are different Kubernetes resources.

Q8. Does creating an Ingress automatically create a controller?#

No.

An appropriate Ingress Controller or implementation must be available.


🧠 Chapter 12 Cheat Sheet#

Remember these four concepts:

Ingress
   ↓
Routing rules
 
Ingress Controller
   ↓
Actually implements the routing
 
Service
   ↓
Stable endpoint for Pods
 
Pod
   ↓
Runs application

Complete flow:

                    INTERNET
                       │
                       ▼
                      DNS
                       │
                       ▼
               Load Balancer
                       │
                       ▼
              Ingress Controller
                       │
              ┌────────┴────────┐
              │                 │
       example.com         api.example.com
              │                 │
              ▼                 ▼
      frontend-service   backend-service
              │                 │
             Pods              Pods

One-line memory trick#

Ingress decides WHERE HTTP traffic should go; Service provides the stable endpoint; Pods run the application.


🎯 Your Kubernetes Architecture So Far#

You've now connected almost everything:

                           INTERNET
                               │
                               ▼
                        Load Balancer
                               │
                               ▼
                           Ingress
                         /          \
                        /            \
                       ▼              ▼
               Frontend Service   API Service
                       │              │
                  ┌────┼────┐    ┌────┼────┐
                  ▼    ▼    ▼    ▼    ▼    ▼
                 Pod  Pod  Pod  Pod  Pod  Pod
                                    │
                                    ▼
                             PostgreSQL Service
                                    │
                                    ▼
                              PostgreSQL Pod
                                    │
                                    ▼
                                   PVC
                                    │
                                    ▼
                            Persistent Storage

And configuration:

ConfigMap ──┐
            ├──> Pod
Secret ─────┘

You're now ready for the scaling and reliability phase.

Next → Chapter 13: Resource Requests & Limits#

We'll learn:

CPU
Memory
Requests
Limits
QoS Classes
OOMKilled
CPU throttling
ResourceQuota
LimitRange

and, most importantly:

How Kubernetes decides how much CPU and memory your Pods need, and what happens when they use too much.

Finished this chapter?

Mark it as complete to track your mastery.

Previous ChapterChapter 11 — Kubernetes NetworkingNext ChapterChapter 13 — Resource Requests & Limits
PrevNext