Ingress resources do nothing until an Ingress controller is installed. This guide deploys ingress-nginx with its maintained Helm chart, publishes a test Service, and validates routing locally before DNS.
1. Prepare and execute
Confirm the active kubeconfig context and namespace before applying changes. Save commands and manifests in version control without credentials.
helm upgrade --install ingress-nginx ingress-nginx
--repo https://kubernetes.github.io/ingress-nginx
--namespace ingress-nginx --create-namespace
kubectl -n ingress-nginx wait --for=condition=Ready pod
-l app.kubernetes.io/component=controller --timeout=180s
2. Declarative configuration
Save the following example in a clearly named YAML file, review it, then use server-side dry-run when the API is available.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata: {name: demo, namespace: ingress-demo}
spec:
ingressClassName: nginx
rules:
- host: demo.example.com
http:
paths:
- path: /
pathType: Prefix
backend: {service: {name: demo, port: {number: 80}}}
3. Verify the result
A successful command is not enough. Inspect resource state, conditions, events, endpoints, logs, and an end-to-end request where applicable.
kubectl create namespace ingress-demo
kubectl -n ingress-demo create deployment demo --image=httpd:2.4-alpine
kubectl -n ingress-demo expose deployment demo --port=80
kubectl apply -f ingress.yaml
kubectl -n ingress-demo describe ingress demo
kubectl -n ingress-nginx port-forward service/ingress-nginx-controller 8080:80
curl --resolve demo.example.com:8080:127.0.0.1 http://demo.example.com:8080/
4. Troubleshooting
A 404 from the controller means the host/path did not match; 503 normally means no healthy backend endpoint. On bare metal, plan NodePort, hostNetwork, or a load-balancer implementation deliberately.
5. Rollback and cleanup
Review the exact target before deleting resources, especially namespaces, claims, Secrets, and cluster-wide add-ons.
kubectl delete namespace ingress-demo
helm uninstall ingress-nginx -n ingress-nginx
Production checklist
- The active context, namespace, and target version were verified.
- Manifests passed client or server-side validation.
- Resource conditions and recent events show no unresolved error.
- Access, network exposure, resource limits, persistence, and rollback were reviewed.
- Commands and expected output were recorded for the operating team.
References: topic documentation and Kubernetes documentation.