Attaching multiple gateways to istio's ingressgateway

I’ve an existing service exposed via LoadBalancer; which I can access no issues up until this point.

Roughly the routing is : Load Balancer > Gateway > Virtual Service > Service

The config of the first Gateway & VirtualService looks like this -

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gw1
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - ns1/*
    port:
      name: http
      number: 80
      protocol: HTTP


apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: vs1
  namespace: ns1
spec:
  gateways:
  - gw1.istio-system.svc.cluster.local
  hosts:
  - '*'
  http:
  - match:
    - uri:
        prefix: /devapi
    route:
    - destination:
        host: devapi-service.ns1.svc.cluster.local
        port:
          number: 8080

Now in a completely different context I would like to deploy a 2nd service and expose via a separate Gateway/VirtualService.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gw2
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - istio-system/*
    port:
      name: http
      number: 80
      protocol: HTTP


apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: vs2
  namespace: istio-system
spec:
  gateways:
  - gw2.istio-system.svc.cluster.local
  hosts:
  - '*'
  http:
  - match:
    - uri:
        prefix: /query
    route:
    - destination:
        host: query-service.istio-system.svc.cluster.local
        port:
          number: 8080

The above end-point is not accessible.

Ignore for a moment why this service is deployed to istio-system namespace. But my question is this - “Is it possible to deploy more than one gateway attaching itself to istio: ingressgateway ?”

Any thoughts on this pls.

@adurai81 this might be caused by giving identical names to the ports on both Gateway resources and deploying them both in the same namespace. See https://github.com/istio/istio/issues/12500

Any updates here? I have same question, asked in other topics…

there is not way to configure multiple Gateway resources with same port?

And on my side I’ve tried with different port names - not working

I am facing the same issue with 1.5.6. Any updates?

I’m having the same issue and I don’t find any error log or anything. Any updates?

I have the same issue and couldn’t find any examples on attaching multiple gateways to same controller. In my case, two apps deployed to the same namespace. Didn’t help renaming ports to unique names and putting all server entries in the same gateway either.

Tested and it works, just creating multiple Gateway resources in different namespaces while mapping to the same port (say 80/443) works are expected.

eg: spec.servers.hosts should be unique

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "httpbin.example.com"