What is Ingress?
- Docker & Kubernetes course
- Advanced
- Lesson 1/70
- 4 min
Learn that Ingress is an HTTP routing layer.
What is an Ingress?
An Ingress is a set of rules routing HTTP/HTTPS traffic from outside the cluster to different Services by host name and path. Instead of opening a separate LoadBalancer for each service, a single entry point is used:
magaza.example.com/ ─► web:80
magaza.example.com/api ─► api:8000
yonetim.example.com/ ─► panel:80An Ingress only defines the rules; the software applying them is the Ingress controller (next lesson).
Listing Ingresses
An Ingress is also a Kubernetes object; kubectl get ingress (abbreviation ing) shows the hosts and the address assigned by the controller:
$ kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
magaza nginx magaza.example.com 192.168.49.2 80, 443 5m
$ kubectl describe ingress magazaIf ADDRESS is empty, either no controller is installed or ingressClassName matches no controller.
Practice Inspect the Ingresses
Write two commands: list the Ingresses in all namespaces; show the magaza Ingress in detail.
Starter code
# buraya yazSample solution
kubectl get ingress -A
kubectl describe ingress magazaExpected output
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE default magaza nginx magaza.example.com 192.168.49.2 80 5m Name: magaza Rules: Host Path Backends ---- ---- -------- magaza.example.com / web:80 (10.244.1.5:80,10.244.2.7:80)
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the benefit of using an Ingress instead of ten LoadBalancers to expose ten HTTP services?
- Faster pods
- Database backup
- Autoscaling
- Path/name-based routing with a single external IP and load balancer Correct answer
Explanation: Cost and management are gathered at one point; TLS is terminated there too.
2 List the Ingresses using the abbreviation.
kubectl get ____
kubectl get ing
Explanation: ing is the abbreviation of ingresses.
3 Match.
| Term | Meaning |
|---|---|
Ingress |
Routing rules |
Ingress controller |
Applies the rules |
host |
By domain name |
path |
By URL path |