Can an istio service be for an arbitrary hostname?

12/2/2019

For in-mesh networking (no ingress or egress in my simple example), it seems like the common practice to have the "host" of a virtual service match an existing kubernetes service:

hosts:
- reviews.default.svc.cluster.local

But is this required? If I wanted to create a virtual service for an entirely different host name, is that possible? For example:

hosts:
- review-service.my-servicemesh

And then call the service at http://review-service.my-servicemesh instead of http://reviews (or http://reviews.default) ?

Or to ask this another way: can I have my namespace of istio (virtual) services be entirely decoupled from the namespace of kubernetes services/namespaces?

-- bsmedberg
istio
kubernetes

1 Answer

12/3/2019

Yes this can be acheived using istio Service Entry. You can create something like this

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: review-servicemesh
spec:
  hosts:
  - "review-service.my-servicemesh"
  location: MESH_EXTERNAL
  ports:
  - number: 80
    name: http
    protocol: HTTP
  resolution: STATIC [or even DNS]
  endpoints:
  - address: <your_endpoint_address>
-- Arunagiriswaran Ezhilan
Source: StackOverflow