- Verify Istio is installed and sidecar injection is enabled for the default namespace.
- Deploy Bookinfo and create an internal VirtualService.
- Create a Gateway resource and update the VirtualService to route external traffic.
- Test access through the Gateway.
- Show how a cloud installation exposes a LoadBalancer for external access.
vs.yaml:
productpage. To expose Bookinfo externally we need a Gateway and then update the VirtualService to reference that Gateway and the external host header.
First, identify the label used by the Istio ingress pod so the Gateway selects the correct ingress proxy. Describe the ingress pod (replace the pod name with yours if different):
Make sure your Gateway’s selector uses the exact label key/value present on your ingress pods (for example
istio=ingress or app=istio-ingress). If the selector doesn’t match, the Gateway will not bind to the ingress proxy.default namespace (so it pairs with the VirtualService). Save this as gw.yaml:
vs.yaml) so it can be invoked via the external host book.info.com and is bound to the Gateway:
- From within the cluster or a node that can reach ClusterIP, you can curl the ClusterIP directly and set the Host header to
book.info.com. - From outside the cluster when using NodePort, use
node-ip:nodePort. - From outside the cluster when using LoadBalancer, use the EXTERNAL-IP (or hostname) provided.
productpage and not the external host, you’ll see a 404 Not Found. After updating the VirtualService to include the host and gateway, retry:
book.info.com will be accepted by the Gateway on port 80 and routed via the VirtualService to the productpage service.
If you are testing from a machine outside the cluster without DNS for book.info.com, pass the Host header with curl (as above) or add a local /etc/hosts entry pointing book.info.com to the load balancer or node IP for convenient testing.
book.info.com) to the LoadBalancer’s external hostname/IP and then simply curl http://book.info.com without manually sending the Host header.
Summary
- Create a VirtualService for the internal service.
- Create a Gateway that selects the Istio ingress pod using the correct label.
- Update the VirtualService to include the external host and reference the Gateway (via
gateways). - Test using the appropriate endpoint (ClusterIP for in-cluster tests, nodeIP:nodePort for NodePort from outside, or external LoadBalancer IP/hostname for cloud installations).