How to connect two services in different namespace using a custom domain?

Hi,

I have two services A and B that are deployed in different namespaces. I can access service B from A using the B.b-ns.svc.cluster.local domain. But it is a bit lengthy and we might move service B to another cluster in the future. So, I want to use ServiceEntry to define a short name for service B and allow service A to access service B without anything even after service B is moved to another cluster.

I am struggling to figure how to define the ServiceEntry for service B when it is in another namespace, and whether I need VirtualService for service B as well.

Most of the documents and examples I found online are about defining a ServiceEntry object for an external server.

Thanks