Ingress — ingressClassName & Common Mistakes¶
Reference: https://kubernetes.io/docs/concepts/services-networking/ingress/
See also:
ingress.md.mdfor full Ingress reference, pathType, routing patterns, TLS.
The ingressClassName Mistake¶
From the exercise — what was written:
What it should be:
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:
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¶
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
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 |