Hello,
I am having problem with configuration of mutual TLS origination with an egress gateway. I am using configuration examples provided in the documentation:
but with certificates being added to egress gateway as kubernetes secrets.
I am getting following error message for curl:
kubectl exec "$(kubectl get pod -l app=sleep -o jsonpath={.items..metadata.name})" -c sleep -- curl -s -v 'http://ADDRESS_HERE/Service/something'
[2021-02-08T10:32:50.151Z] "GET /Service/something HTTP/1.1" 503 UF,URX "TLS error: 268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED" 0 195 47 - "10.240.0.14" "Apache-HttpClient/4.5.3 (Java/11.0.10)" "9777cc5a-a181-4961-b551-0af558c24e43" "<ADDRESS_HERE>" "<IP_ADDRESS_HERE>:9443" outbound|9443||<ADDRESS_HERE> - 10.240.0.164:9443 10.240.0.14:51206 <ADDRESS_HERE> -
[2021-02-08T10:32:50.253Z] "GET /Service/something HTTP/1.1" 503 UF,URX "TLS error: 268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED" 0 195 33 - "10.240.0.14" "Apache-HttpClient/4.5.3 (Java/11.0.10)" "9777cc5a-a181-4961-b551-0af558c24e43" "<ADDRESS_HERE>" "<IP_ADDRESS_HERE>:9443" outbound|9443||<ADDRESS_HERE> - 10.240.0.164:9443 10.240.0.14:51208 <ADDRESS_HERE> -
It looks like there is an issue related to certificate but I believe that the certificates are correct because I am able to connect to the target service from outside the Istio mesh (curl -k --cert client.crt --key client.key -v https://ADDRESS_HERE:9443/Service/something).
Here’s my configuration:
Istio 1.8.0:
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: externalservice-egress
spec:
hosts:
- api.externalservice.com
ports:
- number: 9443
name: https
protocol: HTTPS
resolution: DNS
location: MESH_EXTERNAL
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: externalservice-egress
spec:
selector:
istio: egressgateway
servers:
- port:
number: 9443
name: https
protocol: HTTPS
hosts:
- api.externalservice.com
tls:
mode: ISTIO_MUTUAL
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: externalservice-egress
spec:
host: istio-egressgateway.istio-system.svc.cluster.local
subsets:
- name: externalservice-egress
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
portLevelSettings:
- port:
number: 9443
tls:
mode: ISTIO_MUTUAL
sni: api.externalservice.com
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: externalservice
spec:
hosts:
- api.externalservice.com
gateways:
- externalservice-egress
- mesh
http:
- match:
- gateways:
- mesh
port: 80
route:
- destination:
host: istio-egressgateway.istio-system.svc.cluster.local
subset: externalservice-egress
port:
number: 9443
weight: 100
- match:
- gateways:
- externalservice-egress
port: 9443
route:
- destination:
host: api.externalservice.com
port:
number: 9443
weight: 100
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: externalservice-egress-tls-origination
namespace: istio-system # namespace other than for other configuration items - like for example from documentation
spec:
host: api.externalservice.com
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
portLevelSettings:
- port:
number: 9443
tls:
mode: MUTUAL
sni: api.externalservice.com
caCertificates: /etc/istio/egressgateway-ca-certs/ca.crt
clientCertificate: /etc/istio/egressgateway-certs/tls.crt
privateKey: /etc/istio/egressgateway-certs/tls.key
Kubernetes secrets:
kubectl describe secret -n istio-system istio-egressgateway-certs
Name: istio-egressgateway-certs
Namespace: istio-system
Labels: <none>
Annotations: <none>
Type: kubernetes.io/tls
Data
====
tls.crt: 1956 bytes
tls.key: 1679 bytes
kubectl describe secret -n istio-system istio-egressgateway-ca-certs
Name: istio-egressgateway-ca-certs
Namespace: istio-system
Labels: <none>
Annotations: <none>
Type: Opaque
Data
====
ca.crt: 3792 bytes
I can see both secrets mounted successfully inside istio-egressgateway pod under /etc/istio/ directories.
api.externalservice.com is an external service listening only on https/9443.
Thank you for helping me with this. I appreciate any ideas how to resolve this issue.