Skip to content

Ingress — ingressClassName & Common Mistakes

Reference: https://kubernetes.io/docs/concepts/services-networking/ingress/

See also: ingress.md.md for full Ingress reference, pathType, routing patterns, TLS.


The ingressClassName Mistake

From the exercise — what was written:

spec:
  ingressClassName: nginx-ingress-resource   # WRONG — this is YOUR resource's name

What it should be:

spec:
  ingressClassName: nginx                    # must match the installed controller class

ingressClassName is not a name you make up. It tells Kubernetes which Ingress controller is responsible for processing this resource. The controller watches for Ingress objects with a matching class name. Use the wrong value → controller ignores the resource → no routing, ever.

Always check what's installed first:

kubectl get ingressclass
NAME    CONTROLLER
nginx   k8s.io/ingress-nginx

Use the value from the NAME column — nginx here.


Why KillerCoda Passed Anyway

KillerCoda's checker validated: - Ingress resource exists with the right name - path: /shop, pathType: Prefix, backend nginx-service:80 are correct - Annotation ssl-redirect: "false" is present

It did NOT test actual traffic routing. Wrong ingressClassName still passes the checker — but in a real cluster the ingress controller ignores the resource entirely.

This is the gap between KillerCoda and real-world: the checker validates YAML structure, not behaviour.


The ssl-redirect Annotation

annotations:
  nginx.ingress.kubernetes.io/ssl-redirect: "false"

By default nginx ingress redirects all HTTP → HTTPS. Without a TLS cert configured, this causes redirect loops. "false" disables it.

Value must be the string "false", not the boolean false. All annotation values in Kubernetes are strings — booleans must be quoted.


Full Correct YAML for the Exercise

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress-resource
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /shop
        pathType: Prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80
kubectl apply -f nginx-ingress-resource.yml
kubectl describe ingress nginx-ingress-resource

Common Ingress Mistakes

Mistake Symptom Fix
Wrong ingressClassName Resource created, no routing kubectl get ingressclass, use NAME column value
No ingress controller installed Resource created, nothing happens Install nginx ingress controller
ssl-redirect: false without quotes Ignored or parse error Use "false" (string)
port: number missing, using name Backend unreachable Use number: 80 unless you explicitly defined named ports on the Service
Missing pathType Validation error on apply Always include — Prefix is the safe default
Service in different namespace 502/503 Ingress and Service must be in the same namespace