Can we specify multiple ports in serviceentry?

Hi guys,

I have one service which has two endpoints, for example, the service iris.test.com with two endpoints: 1.2.3.4:20880 and 1.2.3.5:20881. Can I define one serviceEntry for it? I am not sure how I can define these two points now. Is this doable or should I define two separate service entries?

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
 name: iris
spec:
 hosts:
 - iris.test.com
 ports:
 - number: 20800
   name: http
   protocol: HTTP
 location: MESH_EXTERNAL
 resolution: STATIC
 endpoints:
  - address: 1.2.3.4
    ports:
      http: 20880
 - address: 1.2.3.5
    ports:
      http: 20881

I am trying using above yaml but it does not work. Only one of the endpoint is accessible.

It is likely you hit a bug… A similar example is in the API doc that allows multiple endpoints:

Lin

Thanks Lin. I will fire a bug for this :slight_smile:

I cannot reproduce this. It works as expected for me. For testing I used the IP addresses of two available sites and I see them being accessed through iris.test.com:20800 alternatively. Can you explain what you see when it does not work for you? and what error messages you get if any?