I have a Service "service1" in Namespace "a" which is part of the Istio Servicemesh and has both REGISTRY_ONLY configured in the Sidecar as well as Strict mTLS configured in the PeerAuthentication.
Inside the Cluster there exists another ClusterIP Service "service2" in Namespace "b" (service2.b.svc.cluster.local) backed by Pods that is not part of the Mesh (No Sidecars/Configs/etc.). I do not have access to view or edit things in Namespace "b".
Service "service1" needs to call Service "service2" but the calls are routed to BlackHoleCluster according to the Logs of the Sidecar. How do i enable this communication?
[2023-06-13T12:00:00.000Z] "- - -" 0 UH - - "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster - 100.52.158.17:443 100.60.22.142:35254 - -
I have tried including the Service inside the Sidecar Configuration but it does not seem to be able to recognize the plain Kubernetes Service.
apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: default
namespace: a
spec:
egress:
- hosts:
- ./*
- b/*
outboundTrafficPolicy:
mode: REGISTRY_ONLY
The only way i have found to make it work is to create a ServiceEntry Object that explicitly contains the Services ClusterIP as a VIP-Address. (Does not work without specifying the Address)
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: se-service2
namespace: a
spec:
hosts:
- service2.b.svc.cluster.local
addresses:
- 100.52.158.17 # Assigned ClusterIP of "service2.b.svc.cluster.local"
exportTo:
- .
location: MESH_EXTERNAL
ports:
- name: https
number: 443
protocol: HTTPS
resolution: DNS
Is there a better way to configure this without the explicit ClusterIP? I feel like Istio should be able to use the definition of the Target-Service to figure this out automatically.