Kubernetes: istio Gateway in a different namespace than VirtualService

If your istio ingress Gateway is in a different namespace than your VirtualService, then you need to make sure you prefix the gateway reference with that namespace.

For example, if your istio ingress Gateway is in the ‘default’ namespace, yet your Deployment, Service, and VirtualService are in the namespace ‘helloworld’.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: helloworld-virtualservice
  namespace: helloworld
spec:
  gateways:
  - default/ingressgateway

The spec.gateways definition needs the ‘<namespace>/‘ as a prefix to indicate the Gateway is in a different namespace.

REFERENCES

istio reference, VirtualService describing prefix required

istio reference, Gateway

dbones, showing same method of prefix