First of all, thank you very much for this great piece of techonology. We love Istio
After reading and experimenting with various ingress configurations the following question popped up in our team.
What is the best configuration if wanting to combine the nice features given by a Gateway + VirtualService which does TLS termination and provides the possibility to define routing rules (e.g. redirection, rewrite, avoiding public access to some of api paths, etc.) while a service can handle only HTTPS, i.e. no HTTP.
What have we done so far?
A) We have setup Metallb and Istio ingress properly. Our service is exposed to external world.
While we could successfully communicate with our service over HTTPS, we could not apply any uri-based routing rules, as this approach is basing on SNI.
While we could apply uri-based routing rules, we could not communicate with our service, as the communcation between Gateway and our service was over HTTP (despite the mTLS in between), again our service needs HTTPS.
We had some trouble to get this working, and we feel a central termination in a gateway would be our favorite way to go (what do you mean about this idea?).
I think technically we need a combination of B) and C) and possibly also D). Are there any best practices / examples for our use case? I feel our use case is not that special, there should be some simple setup for it, but we could not find it in documentation pages.
After some experiments, following setup was succesfull.
Create a gateway with TLS termination
Create a virtual service defining your routes and destinating your upstream service (using https port)
Create a destination rule with TLS origination in SIMPLE mode
Create a peer authentication for disabling it for your upstream service app
Point 4 took days to get figured out. Missing point 4 leads to TLS handshake failure between istio-proxy and your upstream service app, which results in an error message like below (which you usually see in your browser).
upstream connect error or disconnect/reset before headers. reset reason: connection termination
Hint: You can set the log level to debug in istio-ingressgateway deployment and take a look on the logs of its pod. The logs unveil details about the TLS handshake problem, if you don’t disable peer authentication for your service app as described in point 4 above. You will see some logs similar to this: