Since Service Mesh 1.1, there is a better way to achieve the following. Especially the manual creation of the route is not required anymore. Check the following article to Enable Automatic Route Creation.
Often the question is how to get traffic into the Service Mesh when using a custom domains. Part 4 our our tutorials series OpenShift 4 and Service Mesh will use a dummy domain "hello-world.com" and explains the required settings which must be done.
Modify Gateway and VirtualService
Issue #3 explains how to get ingress traffic into the Service Mesh, by defining the Gateway and the VirtualService. We are currently using the default ingress route defined in the istio_system project.
But what if a custom domain shall be used?
In such case another route must be defined in the istio-system project and small configuration changes must be applied.
First lets create a slightly modified Gateway.yaml:
this is the service as it was created by the operator
OPTIONAL: Add custom domain to local hosts file
The custom domain hello-world.com must be resolvable somehow, pointing to the ingress router of OpenShift.
This can be done, by adding the domain into the local hosts file (with all limitations this brings with it)
# Get IP address of:
oc -n istio-system get route istio-ingressgateway
echo "x.x.x.x hello-world.com" >> /etc/hosts
Create some example traffic
We will reuse the script of Issue #3 to simulate traffic.
Since we changed the domain, the connection will go to hello-world.com