Skip to content

Ingress fanout pattern

The Ingress fanout pattern is a networking configuration in Kubernetes that allows a single Ingress resource to route traffic from the same IP address to multiple different Services based on the HTTP request's Host header^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md].

Mechanism

This pattern operates by utilizing the Kubernetes Ingress Controller to inspect the incoming request's URL.^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md] It distinguishes between requests destined for different services by matching the hostname defined in the Ingress rules.^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md]

For example, a request for foo.com can be routed to a specific backend service, while a request for bar.com is directed to a different service, even though both arrive via the same entry point (IP address).^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md]

Relationship to Virtual Hosting

The implementation of the fanout pattern is often achieved through Name-based Virtual Hosting.^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md] This allows the system to host multiple domains (e.g., foo.com and bar.com) on a single IP infrastructure.^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md] The Ingress resource maps these specific domain names to the corresponding Kubernetes [[Services]].

Configuration

To configure a simple fanout, an Ingress resource defines a list of rules where each rule specifies a host and a corresponding backend service.^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md] When traffic hits the Ingress, the controller matches the Host header of the request to these rules to determine the appropriate routing destination^[400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md].

Sources

  • 400-devops__06-Kubernetes__k8s-ithelp__Day9__README.md