3

If a virtualservice A is defined in namespace A using networking.istio.io, how can it use a gateway B defined in another namespace, namespace B?

Thanks

imriss
  • 1,815
  • 4
  • 31
  • 46

1 Answers1

7

If it´s not in the same namespace as virtual service, you have to specify that in virtual service

Check the spec.gateways section

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo-Mongo
  namespace: bookinfo-namespace
spec:
  gateways:
  - some-config-namespace/my-gateway # can omit the namespace if gateway is in same
                                       namespace as virtual service.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
  namespace: some-config-namespace

There is related istio documentation about that.

Jakub
  • 8,189
  • 1
  • 17
  • 31
  • Thanks. Would the dot notion work too? like: `gateways: my-gateway.some-config-namespace` – imriss Jun 04 '20 at 21:12
  • 1
    @imriss In the documentation there is only the option with my-gateway/some-config-namepsace, so I would say it won´t work with dot. – Jakub Jun 09 '20 at 04:42
  • it doesn't work with dot, it only works with slash, I just had this issue and using slash solved the problem – Christopher Thomas Aug 17 '20 at 21:18
  • FYI, if you are communicating from namespace to namespace, the namespace you communicate to has a subdomain in the url: http://(service-name).(namespace):(port) – Spencer Sutton Aug 25 '21 at 18:53