debugbashkubernetesMajor
Ingress controller not working after installation
Viewed 0 times
ingress controlleringress-nginxingressclassnginxtraefikreverse proxyroutinghttp routing
Error Messages
Problem
Ingress resources are created but traffic is not routed. The Ingress address field is empty or shows no IP, and requests return 404 or connection refused.
Solution
An Ingress resource is just a configuration object — it requires an Ingress controller to act on it. Install an Ingress controller (e.g. ingress-nginx) and ensure it matches the IngressClass in your Ingress spec.
In the Ingress spec, set
# Install ingress-nginx via Helm
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
# Verify controller pods are running
kubectl get pods -n ingress-nginx
# Check ingress status
kubectl get ingress -n your-namespaceIn the Ingress spec, set
ingressClassName: nginx (or omit it if the controller is set as default).Why
Kubernetes Ingress is an API specification, not a built-in implementation. The controller watches Ingress objects and configures the actual reverse proxy (nginx, traefik, haproxy, etc.).
Gotchas
- Multiple ingress controllers can coexist — use IngressClass to route Ingress objects to the right controller
- On minikube, run
minikube addons enable ingressinstead of installing separately - The ingress controller itself is usually exposed via a LoadBalancer service — on bare metal it stays Pending without MetalLB
- Annotations vary per controller —
nginx.ingress.kubernetes.io/annotations only work with ingress-nginx, not traefik
Code Snippets
Ingress with path-based routing using ingress-nginx
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: app.example.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api-service
port:
number: 8080
- path: /
pathType: Prefix
backend:
service:
name: frontend-service
port:
number: 80Context
Setting up HTTP routing for multiple services using a single entry point
Revisions (0)
No revisions yet.