liveBook · Manning

Host-based routing

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

Host-based routing is a traffic-routing technique that selects a backend according to the hostname in a request.

Host-based routing selects a Kubernetes backend from the hostname in an HTTP request. An Ingress resource defines the rule, and an Ingress controller interprets it to forward traffic to a Service. section 6.3

Use the routing chain to configure and verify the behavior:

  • Install or verify an Ingress controller, which proxies external HTTP and HTTPS traffic into the cluster. section 6.3
  • Create a Deployment and expose it through a Service; Ingress rules forward requests to the Service rather than directly to the workload. section 6.3

Route two hostnames

An Ingress can route hello.com at / to hello-svc on port 80 and app.hello.com at / to nginx on port 8080. The hostname must resolve to the Ingress endpoint before curl can verify the result.

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains controller, Service, Ingress, DNS, and curl verification, but does not descend into controller internals.
Examples
Uses hello.com, app.hello.com, hello-svc, nginx, kubectl output, a host entry, and curl responses.
What it assumes
Assumes familiarity with Services and introduces the Ingress controller and host-based rules operationally.
What you can do after
Build it from scratch by installing an Ingress controller, exposing a Deployment, defining host rules, and verifying routing.
How it connects
Connects Ingress controllers, Ingress resources, Services, Deployments, DNS resolution, and HTTP path routing.

Also explained in

Compare how 2 books explain host-based routing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.