I have a k8s cluster with Istio deployed in the istio-system namespace, and sidecar injection enabled by default in another namespace called mesh-apps. I also have a second legacy namespace which contains certain applications that do their own TLS termination. I am trying to setup mTLS access between services running inside the mesh-apps namespace and those running inside legacy.
For this purpose, I have done the following:
Created a secret in the
mesh-appsnamespace containing the client cert, key and CAcert to be used to connect with an application in legacy via mTLS.Mounted these at a well-defined location inside a pod (the
sleeppod in Istio samples actually) running inmesh-apps.Deployed an app inside
legacyand exposed it using a ClusterIP service calledmymtls-appon port 8443.Created the following destination rule in the
mesh-appsnamespace, hoping that this enables mTLS access frommesh-appstolegacy.--- apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: originate-mtls spec: host: mymtls-app.legacy.svc.cluster.local trafficPolicy: portLevelSettings: - port: number: 8443 tls: mode: MUTUAL clientCertificate: /etc/sleep/tls/server.cert privateKey: /etc/sleep/tls/server.key caCertificates: /etc/sleep/tls/ca.pem sni: mymtls-app.legacy.svc.cluster.local
Now when I run the following command from inside the sleep pod, I would have expected the above DestinationRule to take effect:
kubectl exec sleep-37893-foobar -c sleep -- curl http://mymtls-app.legacy.svc.cluster.local:8443/hello
But instead I just get the error:
Client sent an HTTP request to an HTTPS server.
If I add https in the URL, then this is the error:
curl: (56) OpenSSL SSL_read: error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate, errno 0
command terminated with exit code 56