kubernetesistiogatewayservice-virtualization

in istio, how a virtualservice defined in a namespace can use a gateway defined in another namespace


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


Solution

  • 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.