1

Cross-namespace services. I was trying to have a pod in namespace nsA calling a pod in namespace nsB. But I wanted to avoid any concern to the developer about the location of the final service, so just use a hostname in the invocation and I will redirect it using Istio. My assumption was that in the code I would just call to a hostname, something like http://podB:9080 and now I would create a Virtual service like this to redirect it to the right namespace

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: podB
spec:
  hosts:
  - podB
  http:
  - route:
    - destination:
        host: podB.nsB.svc.cluster.local
        subset: v1

But this does not work, for this to work I have to create a service called podB in namespace nsA. It can be an "empty" service without any Endpoint but the service has to exist for Istio Proxy to handle the request, if it does not exist the virtualService does not operate.

Any recommendation for this scenario?

Jxadro
  • 1,497
  • 2
  • 16
  • 36
  • you don't need istio to do this. Create a headless service without selectors with an endpoint object pointing to the second service. – suren Dec 27 '20 at 11:41

2 Answers2

0

I hope this other post could help: Istio: Blue/green deployment

(sorry I do not have reputation enough to write comments, only answers)

AlbertoVI
  • 102
  • 6
  • Thank you but it does not apply, in that sample happens two things, the first is that the service is running in both namespaces and the second is that they use FQDN so or I create a dummy service in the consumer namespace or I have to know where the final service is to set the FQDN. I think what I want is not possible. – Jxadro Apr 05 '19 at 08:46
0

I ran into the same problem because the application itself needed this DNS record when making a request. I think ISTIO 1.8 can solve this problem by adding its own DNS resolution. Maybe you can give it a try