Skip to main content
KubernetesAdvanced9 min read2026-03-01

Kubernetes Ingress with NGINX Ingress Controller

Route external HTTP/HTTPS traffic to multiple backend services using URL paths, subdomains, and SSL/TLS.

Prerequisites

  • Kubernetes Service tutorial
  • Basic DNS and SSL understanding

1. Ingress Routing Definition

Route requests based on hostname and URL prefixes to target ClusterIP services.

yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  ingressClassName: nginx
  rules:
    - host: devfixhub.com
      http:
        paths:
          - path: /api
            pathType: Prefix
            backend:
              service:
                name: backend-service
                port:
                  number: 80
          - path: /
            pathType: Prefix
            backend:
              service:
                name: frontend-service
                port:
                  number: 80

Best Practices & Architecture Advice

  • Automate SSL/TLS certificate management using cert-manager and Let's Encrypt.

Common Mistakes to Watch Out For

  • Forgetting to install the Ingress Controller (e.g. ingress-nginx) in the cluster; an Ingress resource does nothing without an active controller.

Frequently Asked Questions

What is the difference between a Service and an Ingress?

A Service operates at Layer 4 (TCP/UDP IP routing). An Ingress operates at Layer 7 (HTTP/HTTPS host headers, path matching, SSL termination).