Lesson 2 · Unit 02
Ingress
One entry point that routes by host and path, with TLS at the edge.
What you practise
- One entry point routing by host and path, TLS at the edge
Try a question from this lesson
Pick one
The shop, the blog and the docs site each sit behind their own LoadBalancer Service: three cloud balancers, three public IPs. What lets one entry point serve all three?
Hint
Think of what an HTTP request carries that a bare TCP connection does not.
Correct answer
Routing each HTTP request by its Host header and path
Why
An HTTP request names the site it wants in its Host header and the page in its path. A proxy that reads those can sit behind one address and forward each request to the right Service: a reverse proxy, as in the networking roadmap.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Ingress: rules for the front door
An Ingress is a list of HTTP routing rules: for this host and this path, send the request to that Service.
The rules do nothing alone. An ingress controller, a reverse proxy running in the cluster, reads every Ingress and configures itself to match. A cluster does not always come with one.
The Ingress API is stable but frozen. New features go to its successor, the Gateway API, which routes on the same idea.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
spec:
rules:
- host: shop.example.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api
port:
number: 80Concept
TLS at the edge
HTTPS needs a certificate and a private key. You store both in a Secret and name it in the Ingress under tls.
The ingress controller then answers on port 443, does the TLS handshake with the browser, and forwards the decrypted request to the Service. This is called terminating TLS.
One place holds the certificates for every app behind the entry point. Past that point, traffic inside the cluster is plain HTTP unless you arrange otherwise.
spec:
tls:
- hosts:
- shop.example.com
secretName: shop-tls
rules:
- host: shop.example.com
# http paths as before9 more exercises in the app
- 1× fill the blanks
- 4× multiple choice
- 2× true or false
- 1× type the answer
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.