I’m trying to achieve following:
- Egress traffic from local istio-proxy sidecar --> egress g/w --> ExtServerIP:Port1
- Egress traffic from local istio-proxy sidecar --> egress g/w --> ExtServerIP:Port2
Application to invoke path #1 via http://ExtServerIP:Port1 and to #2 using http://ExtServerIP:Port2
Following are the resources were attempted but not successful. Using istio 1.4 release.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: srv1-example-com-direct-hook-to-egress-gateway-vs
namespace: app-ns
spec:
exportTo:
- .
gateways:
- mesh
hosts:
- 10.10.10.10
http:
- headers:
request:
set:
host: srv1.example.com
match:
- gateways:
- mesh
port: 3002
route:
- destination:
host: istio-egressgateway-li.app-ns.svc.cluster.local
port:
number: 443
subset: srv1-example-com
weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: srv1-example-com-direct-through-egress-gateway-vs
namespace: app-ns
spec:
exportTo:
- .
gateways:
- srv1-example-com-egress-gw
hosts:
- srv1.example.com
http:
- match:
- gateways:
- srv1-example-com-egress-gw
port: 443
route:
- destination:
host: srv1.example.com
port:
number: 3002
weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: srv1-example-com-egress-gateway-subset-dr
namespace: app-ns
spec:
exportTo:
- .
host: istio-egressgateway-li.app-ns.svc.cluster.local
subsets:
- name: srv1-example-com
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
portLevelSettings:
- port:
number: 443
tls:
mode: ISTIO_MUTUAL
sni: srv1.example.com
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: srv1-example-com-egress-gw
namespace: app-ns
spec:
selector:
istio: app-ns-egressgateway-li
servers:
- hosts:
- srv1.example.com
port:
name: https-port-443
number: 443
protocol: HTTPS
tls:
caCertificates: /etc/certs/root-cert.pem
minProtocolVersion: TLSV1_1
mode: MUTUAL
privateKey: /etc/certs/key.pem
serverCertificate: /etc/certs/cert-chain.pem
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: srv1-example-com-external-host-se
namespace: app-ns
spec:
addresses:
- 10.10.10.10
endpoints:
- address: 10.10.10.10
exportTo:
- .
hosts:
- srv1.example.com
ports:
- name: https
number: 3002
protocol: HTTPS
resolution: STATIC
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: srv1-example-com-secure-port-dr
namespace: app-ns
spec:
exportTo:
- .
host: srv1.example.com
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
portLevelSettings:
- port:
number: 3002
tls:
caCertificates: /etc/app/ca-certs/ca-chain.cert.pem
clientCertificate: /etc/app/certs/tls.crt
mode: MUTUAL
privateKey: /etc/app/certs/tls.key
sni: srv1.example.com
Observation is that only port 80 on mesh is working if any other port e.g 3002 here is specified, the flow is on tcp filter as seen from logs.
Any help here?