Ingress Resource Validation
Validate Kubernetes Ingress manifests for proper API version, required fields, TLS configuration, and host/path rules. Ensure traffic routing is correctly defined.
Networking
Detailed Explanation
Ingress Resource Validation
Ingress resources define how external HTTP/HTTPS traffic reaches Services inside the cluster. A misconfigured Ingress can result in 404 errors, TLS issues, or routing failures.
Example Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
labels:
app: myapp
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx
tls:
- hosts:
- myapp.example.com
secretName: myapp-tls
rules:
- host: myapp.example.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api-service
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: web-service
port:
number: 80
Common Ingress Issues
| Issue | Impact | Fix |
|---|---|---|
| Wrong apiVersion | Rejected by API server | Use networking.k8s.io/v1 |
Missing ingressClassName |
No controller picks it up | Set to your controller class |
Missing pathType |
Required in v1 | Set to Prefix, Exact, or ImplementationSpecific |
| TLS secret missing | HTTPS fails | Create the Secret or use cert-manager |
| No host specified | Matches all hosts | Usually unintentional in production |
API Version History
The Ingress resource has gone through several API versions:
extensions/v1beta1— Deprecated in k8s 1.14, removed in 1.22networking.k8s.io/v1beta1— Deprecated in k8s 1.19, removed in 1.22networking.k8s.io/v1— Current stable version
Key Changes in networking.k8s.io/v1
pathTypeis now required (was optional in beta)ingressClassNamereplaces thekubernetes.io/ingress.classannotation- Backend service port uses
port.numberorport.name(not justservicePort)
Use Case
Validating Ingress configurations before deployment to prevent routing issues, TLS misconfigurations, and API compatibility problems. Essential when migrating from older Kubernetes versions.