What Is a Kubernetes Ingress? Route HTTP Requests to Services by Host and Path
A Kubernetes Ingress is a resource that declares how HTTP and HTTPS requests from outside a cluster should reach Services inside it, based on hostnames and URL paths. A separate Ingress controller must receive external traffic and implement those rules. Creating an Ingress object alone does not create a load balancer or public address.
How do Service and Ingress divide the work?
A Service groups a changing set of Pods behind a stable name and port inside the cluster. An Ingress is an HTTP/HTTPS entry rule that checks a request's host and path to choose a Service. For example, shop.example.com/catalog can go to a catalog Service while shop.example.com/account goes to an account Service. A Service hides Pod changes; an Ingress connects web routes to backends.
A typical request path is: DNS resolves the domain to the Ingress controller's external address; the controller compares the HTTP Host and URL path with Ingress rules; then it forwards to the matching backend Service and port, and the Service connects to ready Pods. Ingress itself does not create all of DNS records, external load balancers, controller installations, or their configuration.
Client → DNS → controller external address → host/path rule → backend Service:port → ready PodIngress is for web HTTP/HTTPS rules. It does not expose arbitrary TCP/UDP ports; for those, consider a NodePort or LoadBalancer Service instead.
Rules combine a host, path, class, and backend
A rule can name a host and one or more paths, each connected to a Service backend. Both the host and path must match the request. A rule without a host may apply to all hosts reaching the controller address, so check the intended exposure. .spec.ingressClassName selects the IngressClass and controller that should implement the resource. If omitted, the cluster should have a default IngressClass; in an operational manifest, specify the class and consult that controller's documentation.
Every path requires a pathType. Prefix matches case-sensitive path elements split by /, not an arbitrary string prefix. Thus /catalog matches /catalog and /catalog/item, but not /catalogue. Exact matches the entire path with case sensitivity. ImplementationSpecific delegates matching behavior to the chosen IngressClass; use Prefix or Exact when you need portable semantics.
Example: route a public catalog path to an existing Service
The manifest below sends shop.example.com/catalog and its subpaths to port 80 of the web Service in namespace shop. The Service and a controller for the selected class must already exist. public is an example class name; replace it with a class shown by kubectl get ingressclass. DNS for the domain must point to the controller's external address. For TLS, prepare the shop-example-tls Secret in the same namespace, with a certificate valid for shop.example.com. This manifest and the commands are illustrative; they were not applied to a cluster or tested with a live request.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop-web
namespace: shop
spec:
ingressClassName: public
tls:
- hosts:
- shop.example.com
secretName: shop-example-tls
rules:
- host: shop.example.com
http:
paths:
- path: /catalog
pathType: Prefix
backend:
service:
name: web
port:
number: 80This rule forwards the /catalog path to the backend; it does not automatically strip the path or rewrite it to /. Do not assume the application receives a different path. If rewriting is needed, check whether the selected controller supports it and how to configure it. Annotations are often controller-specific, so do not assume they have the same effect with another implementation.
Where does TLS terminate?
In the basic Ingress TLS model, the HTTPS connection terminates at the ingress point, and traffic from there to the Service and Pods is plaintext. The TLS Secret contains the certificate and private key; its TLS host should match the host in the HTTP rule. Seeing HTTPS in a browser does not prove that the in-cluster hop is encrypted. If encryption to the backend is required, check the chosen controller's support, certificate validation, and re-encryption behavior.
TLS features and optional settings differ among controllers. The Ingress API defines a common rule shape, while advanced rewrites, authentication, rate limits, and session features often depend on controller-specific settings or policies. Before choosing a controller, compare its public-address provisioning, IngressClass, annotation compatibility, TLS behavior, update process, and support policy in its documentation.
Apply and check the response
These commands are examples and were not run. First confirm the cluster context and namespace, that the web Service has ready endpoints, and that the public class and TLS Secret exist.
kubectl config current-context
kubectl get ingressclass
kubectl get service web -n shop
kubectl get endpointslice -n shop -l kubernetes.io/service-name=web
kubectl apply -f <shop-ingress.yaml>
kubectl get ingress shop-web -n shop -o wide
kubectl describe ingress shop-web -n shopWhen the ADDRESS field is populated and what form it takes depend on the controller. In a test environment where public DNS has not changed yet, you can send a request with an explicit HTTP Host after obtaining the actual controller address. In the commands below, replace INGRESS_IP with that address.
curl --resolve shop.example.com:80:$INGRESS_IP http://shop.example.com/catalog/item
curl --resolve shop.example.com:443:$INGRESS_IP https://shop.example.com/catalog/itemCheck the expected backend application's response together with controller logs. curl --resolve changes name resolution only for that request; it does not edit DNS. Do not make an option that disables HTTPS certificate verification your default diagnostic step. Fix the certificate hostname or trust chain instead.
Where to look when the response is unexpected
`ADDRESS` is empty or external access fails: check that the Ingress controller is installed and healthy, the class points to that controller, and the load balancer, firewall, and DNS are configured. Address assignment varies by implementation.
A default 404 or another backend response appears: check the request Host header, path, `pathType`, and selected IngressClass. Handling unmatched requests depends on the controller.
Backend connection fails: check the Service name and port in the Ingress, its namespace, actual Service endpoints, and Pod readiness in that order. An Ingress Service backend must be in the same namespace as the Ingress.
HTTPS certificate error: check the TLS Secret name and namespace, certificate and key, TLS host and rule host, certificate domain, and controller events and logs. Use the controller documentation to determine its exact TLS behavior.
Do not diagnose from one status code alone. Compare the Ingress status and events, controller logs, and Service EndpointSlices to distinguish a rule mismatch from missing backends.
Keep Ingress or consider Gateway API?
The Kubernetes Ingress API remains stable and the project has no plan to remove it, but development is frozen and no further features are planned. If an existing controller and its rules meet your needs, there is no need to replace a working Ingress urgently. For a new design that separates infrastructure, cluster, and application responsibilities or needs more expressive routing, consider Gateway API. It uses resources such as GatewayClass, Gateway, and HTTPRoute, but the cluster must have the required CRDs and a controller that supports the needed features. Moving from Ingress is a migration to separate resources, not an automatic field swap.
Sources
[Kubernetes Ingress concepts, rules, TLS, and API status](https://kubernetes.io/docs/concepts/services-networking/ingress/)
[Ingress controllers and implementation differences](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/)
[Gateway API resource model and Ingress migration](https://kubernetes.io/docs/concepts/services-networking/gateway/)
[Kubernetes Service and backend connections](https://kubernetes.io/docs/concepts/services-networking/service/)
[DNS for Services and Pods](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/)
Scope: HTTP/HTTPS Ingress rules in Kubernetes networking.k8s.io/v1, controller and class, Service backends, path matching, TLS boundary, verification, and diagnosis. Kubernetes official documentation reviewed on 2026-11-23. The example host, class, Service, and Secret are assumptions; the manifest and commands were not run. Follow the selected implementation's documentation for controller installation, annotations, DNS, and certificate automation.