I am using Istio as an ingress controller within a kubernetes cluster. I have a single Gateway that receives HTTPS traffic for a host - my-service.domain.com
I need to split traffic for this host, based on URL prefix, between:
https : // my-service.domain .com/internal - a service internal to the cluster - accepts HTTP
https : // my-service.domain .com/external - an external service - accepts HTTPS
I created a ServiceEntry for the external service and a DestinationRule also, but it seems that Istio is still sending HTTP traffic to the external service. (The external service indicates it is receiving HTTP traffic on port 443.)
How do I configure Istio so that it originates a new HTTPS connection when forwarding traffic to the external service?
What is the meaning of “targetPort” and how is that different than the main port number? What’s the difference between specifying a targetPort and not doing so?
The documentation just says “The port number on the endpoint where the traffic will be received” but that doesn’t tell me much.
When you direct the traffic in the VS you aren’t specifying port, and anything sent to external-service.otherdomain.com goes to the port 80 listener, even if you’re originating TLS (with DR). By adding the targetPort to the ServiceEntry your saying that anything sent to 80 should go to 443 (because you’re originating TLS with DR).
That’s odd; since the termination is at the gateway, you’re just originating a non-tls connection anyway. and your resources are exactly the same as with in the docs (granted, since you’re terminating at GW, you can send the traffic in VS to 80, so it gets originated with DR).
I am setting up a test cluster to try this out - my guess is the docs should be correct, but you never know
Here’s what I tried and it worked – note that I am sending traffic to GW on 80, but I don’t think it should matter if it’s 443 because it should be terminated (I am assuming you have tls mode SIMPLE on the GW + credentials with the cert).
I tried the configs you gave, but now I am getting:
HTTP/2 502
upstream connect error or disconnect/reset before headers. reset reason: protocol error
(I suspect this has the same meaning as the other error I was getting. It’s just that edition.cnn.com terminates the connection immediately, whereas the other external service I’ve been trying sends back an actual response body with a more specific error.)
By default, all Istio resources are available to use across the namespaces-- unless you have an exportTo field explicitly specified (that would make the resource available in specific namespaces only).