Reviewing the Preconfigured Gateway
First, let’s examine the existing Gateway configuration from our samples folder. Notice that this configuration uses a wildcard ”*” for the host value. This allows the Gateway to accept traffic from any host.Ensure that you understand how wildcard hosts affect traffic routing in Istio before proceeding.
Deploying the Bookinfo Application
Before configuring a new Gateway with a specific hostname, verify that all required applications are running. Deploy the Bookinfo application using the provided YAML configuration:Creating a Gateway with a Specific Hostname
Next, we create a Gateway that listens specifically for requests targeting the hostname “bookinfo.app”. This configuration accepts HTTP traffic on port 80 directed to that host.Configuring the Virtual Service
For the Gateway configuration to work as intended, you need to define a Virtual Service that routes incoming requests to the correct service based on specific URI match rules. It is crucial that the hosts defined in the Virtual Service match those in the Gateway. Apply the Virtual Service configuration with the command below:Ensure that the hosts in your Gateway and Virtual Service configurations match exactly for proper routing.
Testing the Configuration
To confirm the Gateway correctly handles traffic, include the header “Host: bookinfo.app” when sending your requests. For example, to test the configuration using curl, run:Always include the appropriate Host header in your requests to ensure they are routed correctly through the Istio Gateway.
Verifying in Kiali
Kiali provides a graphical view of your Istio configuration. You can confirm your Gateway settings by checking the Istio config section in Kiali. Below is an example of how your Gateway configuration might appear in Kiali:Accessing the Application via a Browser
To test your configuration in a web browser, update your local hosts file so that “bookinfo.app” resolves to your cluster’s IP address. For example, if you are using Minikube, execute:<PORT> with your actual ingress port. You should see the Bookinfo product page load correctly.