Using the same Istio GateWay with multiple ports and protocols

10/16/2018

I am trying to configure an istio GateWay with two different protocols (GRPC and HTTP)

Right now, I have two different gateways one each for GRPC and HTTP as below

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gwgrpc
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 7878
      name: http
      protocol: GRPC
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gwrest
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 7979
      name: http
      protocol: HTTP
    hosts:
    - "*"

Is it possible to use same gateway with different protocols and ports?

-- DoIt
envoyproxy
istio
kubectl
kubernetes

2 Answers

10/16/2018

You should be able to combine the two Gateways. The only problem is that both your ports have the same name. Something like this should work.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gwgrpc
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 7878
      name: grpc
      protocol: GRPC
    hosts:
    - "*"
  - port:
      number: 7979
      name: http
      protocol: HTTP
    hosts:
    - "*"
-- Frank B
Source: StackOverflow

10/17/2018

You may want use this example as a template. Agree with @Frank: You need to change the name. Here is a small part of an example config

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    app: my-gatweway-controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - uk.bookinfo.com
    - eu.bookinfo.com
    tls:
      httpsRedirect: true # sends 301 redirect for http requests
  - port:
      number: 443
      name: https
      protocol: HTTPS
    hosts:
    - uk.bookinfo.com
    - eu.bookinfo.com
-- VKR
Source: StackOverflow