Configure Host-Based and Path-Based Routing

Learn how we can configure host and path-based routing and create ingress objects.

In the upcoming lessons, we'll deploy two apps and a single Ingress object. The Ingress will route traffic to both apps via a single load balancer. This can be a cloud-based load balancer or localhost on a local cluster.

We’ll complete all the following steps:

  1. Deploy an app called shield and front it with a ClusterIP Service (backend) called svc-shield

  2. Deploy an app called hydra and front it with a ClusterIP Service (backend) called svc-hydra

  3. Deploy an Ingress object that creates a single load balancer and routing rules for the following hostnames and paths

  • Host-based: shield.mcu.com >> svc-shield

  • Host-based: hydra.mcu.com >> svc-hydra

  • Path-based: mcu.com/shield >> svc-shield

  • Path-based: mcu.com/hydra >> svc-hydra

  1. Configure DNS name resolution to that shield.mcu.com, hydra.mcu.com, and mcu.com point to the load balancer

The following figure shows the overall architecture using host-based routing.

Get hands-on with 1400+ tech skills courses.