CKAD — Ingress Basics

1 minute read

Ingress

An Ingress resource manages external HTTP/HTTPS access to Services in your cluster. Think of it as a smart reverse proxy.

Why Not Just Use NodePort or LoadBalancer?

Approach Problem
NodePort High ports (30000-32767), no TLS, no path routing
LoadBalancer One LB per Service — expensive at scale
Ingress One entry point, path + host routing, TLS, cost-effective

How Ingress Works

                    ┌──────────────┐
 Internet ────────→ │ Ingress       │
                    │ Controller    │
                    │ (nginx/traefik)│
                    └───────┬──────┘
                            │ path-based routing
              ┌─────────────┼─────────────┐
              ▼             ▼             ▼
         /api/*        /web/*        /admin/*
    ┌──────────┐  ┌──────────┐  ┌──────────┐
    │ api-svc  │  │ web-svc  │  │ admin-svc│
    └──────────┘  └──────────┘  └──────────┘

Two components:

  1. Ingress Controller — The actual proxy (nginx, traefik, HAProxy). Must be installed separately.
  2. Ingress Resource — The routing rules you define in YAML.

Basic Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: simple-ingress
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web
            port:
              number: 80
kubectl apply -f simple-ingress.yaml
kubectl get ingress
# Expected:
# NAME             CLASS   HOSTS   ADDRESS        PORTS   AGE
# simple-ingress   nginx   *       192.168.1.50   80      10s

Path Types

PathType Behavior Example
Prefix Matches URL path prefix /api matches /api, /api/v1, /api/users
Exact Matches the exact URL path /api matches only /api, not /api/v1
ImplementationSpecific Depends on the IngressClass Varies

Next: Ingress Routing →

Updated: