liveBook · Manning

Virtual hosting

As explained in Kubernetes in Action, Second Edition

Virtual hosting is a technique that routes requests to different backends based on the requested host name.

Virtual hosting routes requests to different backends according to the requested host name. In Kubernetes, an Ingress uses host rules to decide which Service receives an HTTP request. section 12.2.1

The client must send the matching Host header; requesting the Ingress IP alone is insufficient. DNS can map the hostname to the Ingress address, while local testing can use curl --resolve or a hosts-file entry. section 12.2.1

Route kiada.example.com to a Service

An Ingress rule maps host kiada.example.com and path / to the kiada Service on port 80. Test it with curl --resolve kiada.example.com:80:11.22.33.44 http://kiada.example.com.

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains host matching, DNS resolution, and local testing, but does not descend into Ingress-controller implementation.
Examples
Uses kiada.example.com, an Ingress manifest, address 11.22.33.44, curl --resolve, and a hosts-file entry.
What it assumes
Assumes familiarity with HTTP requests, hostnames, DNS, Ingresses, and Kubernetes Services.
What you can do after
Operate/configure it by defining an Ingress host rule and testing it with DNS, curl --resolve, or a hosts-file mapping.
How it connects
Connects Ingress, DNS, Host headers, HTTP requests, and Kubernetes Services.

Related concepts

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