domain registry with Istio ServiceEntry

8/27/2018

Now I am testing the scenario running apps on Istio.
I cant access to legacy codes, so I cant change request urls.

For that, I made some simple apps.

I am not sure this scenario is available on Istio.

I have two applications(order and customer) On the order app, there is code calling customer app with url "http://customer-app:8080/customer".

Now, I want to run two apps on K8S with Istio.
And I don't want to change my code especially calling urls.
(I know I can call each service with service-name.
but I want to make customer service name with "customer-service" not "customer-app")

I find there is a VirtualService which can register MESH_INTERNAL.
I make yaml file like that.

apiVersion: networking.istio.io/v1alpha3   
kind: ServiceEntry   
metadata:  
  name: customer-service-entry  
spec:  
  hosts:  
  - http://customer-app:8080  
  location: MESH_INTERNAL  
  ports:  
  - number: 8080  
    name: http  
    protocol: http  
  endpoints:  
  - address: customer-service  
    ports:  
      http: 8080  

is it possible scenario using virtual domain?

-- sury
istio
kubernetes

1 Answer

8/28/2018

You should be able to do this using a VirtualService:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: customer-app
spec:
  hosts:
  - customer-app
  http:
  - match:
    - port: 8080
    route:
    - destination:
        host: customer-service
        port:
          number: 9080

You will also need to define a dummy K8S service for customer-app, so that it's resolvable:

apiVersion: v1
kind: Service
metadata:
  name: customer-app
spec:
  ports:
  - port: 8080
    name: http
-- Frank B
Source: StackOverflow