I've setup Istio using the helm charts, and I'm trying to expose services to the istio-ingressgateway.
Here's the config I've decided to go with:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: grafana-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 31400
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: kiali-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 15029
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: prometheus-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 15030
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: grafana-vts
namespace: istio-system
spec:
hosts:
- "*"
gateways:
- grafana-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
host: grafana.istio-system.svc.cluster.local
port:
number: 3000
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: kiali-vts
namespace: istio-system
spec:
hosts:
- "*"
gateways:
- kiali-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
host: kiali.istio-system.svc.cluster.local
port:
number: 20001
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: prometheus-vts
namespace: istio-system
spec:
hosts:
- "*"
gateways:
- prometheus-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
host: prometheus.istio-system.svc.cluster.local
port:
number: 9090
However - this only routes grafana through ports 31400, 15029 and 15030, while it's supposed to do so just for 31400.
If I'm using just one Gateway and rewrite the uri, it throws up a 404 error/tells me the reverse-proxy isn't setup properly
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: all-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: grafana-vts
namespace: istio-system
spec:
hosts:
- "*"
gateways:
- all-gateway
http:
- match:
- uri:
prefix: "/grafana"
rewrite:
uri: /
route:
- destination:
host: grafana.istio-system.svc.cluster.local
port:
number: 3000
and etc...
I'm a bit new to istio, and the examples I've browsed through don't exactly talk about these. If you've got an idea, it'd be swell - is it because of how I've wildcarded the hosts?
Your gateway and virtual services are mixed since the same hosts (*
) are used for all of them, so their behavior is undefined in Istio. I would allocate fake hostnames, for example, my-grafana.com
, my-kiali.com
and use them in the Gateway and Virtual Service definitions. I would add these fake hostnames to the /etc/hosts/
file and use them to access Grafana and Kiali from my computer.