# Connecting to Ray Cluster through Istio VirtualService

**URL:** <https://discuss.ray.io/t/connecting-to-ray-cluster-through-istio-virtualservice/10445>\
**Category:** Kubernetes\
**Created:** [April 29, 2023, 8:19pm UTC](https://discuss.ray.io/t/connecting-to-ray-cluster-through-istio-virtualservice/10445 "2023-04-29T20:19:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sercan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sercan/32/4337_2.png) [@sercan](https://discuss.ray.io/u/sercan)\
**Post date:** [April 29, 2023, 8:19pm UTC](https://discuss.ray.io/t/connecting-to-ray-cluster-through-istio-virtualservice/10445/1 "2023-04-29T20:19:28Z")

</div>

Hello!

I have a Ray Cluster (version 2.2.0) in Kubernetes environment. We create Istio `VirtualService`s for application endpoints instead of using direct internal service URLs.

For Ray client endpoint, I have following `VirtualService`;

```auto
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ray-cluster-vs
  namespace: kuberay
spec:
  hosts:
    - "ray-cluster.<domain_name>"
  gateways:
    - istio-system/some-gateway
  http:
    - match:
        - uri:
            prefix: /
      route:
        - destination:
            host: kuberay-head-svc.kuberay.svc.cluster.local
            port:
              number: 10001

```

With the above service, I expect to connect Ray Cluster as `ray.init(address="https://ray-cluster.<domain_name>")`, but this line throws below error;

```auto
RuntimeError: Module: https does not exist.
This module was parsed from Address: https://ray-cluster.<domain_name>

```

I have another `VirtualService` with exact same structure for port 8265 by which I can access dashboard. This makes me think that the virtual service structure is okay but somehow Ray expects `ray://` protocol in `address` variable to connect to the cluster. Just to test it, when I change the protocol, the mentioned error is gone but as the URL is wrong, it throws connection timeout error after a while.

PS: Connection as in `ray.init(address="ray://kuberay-head-svc.kuberay:10001")` works fine.

Could anyone please suggest something to me here?

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [May 1, 2023, 8:59pm UTC](https://discuss.ray.io/t/connecting-to-ray-cluster-through-istio-virtualservice/10445/2 "2023-05-01T20:59:47Z")

</div>

@sercan `ray.init(URL)` according to [docs](https://docs.ray.io/en/latest/ray-core/api/doc/ray.init.html?highlight=ray.init#ray.init) only support `ray://` URL and protocol syntax.

I don’t believe we support the `https://` protocol

---

<div class="post-metadata">

**Author:** ![sercan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sercan/32/4337_2.png) [@sercan](https://discuss.ray.io/u/sercan)\
**Post date:** [May 3, 2023, 2:37pm UTC](https://discuss.ray.io/t/connecting-to-ray-cluster-through-istio-virtualservice/10445/3 "2023-05-03T14:37:58Z")

</div>

@Jules_Damji Thank you for your response. In this case I will try to fix the issue by trying to resolve the URL between `VirtualService` and Ray client.

I am not sure if it is good idea or not, but do you think Ray team would consider adding another parameter to `ray.init()` by which a different protocol could be specified when needed. If the parameter is empty, the protocol could be read from URL as it happens now.

Please consider my case; I still want to use `ray://` protocol, but at the same time I need to connect to Ray cluster through Istio `VirtualService` which does not support `ray://` [protocol](https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#:~:text=Istio%20supports%20proxying%20any%20TCP,the%20protocol%20must%20be%20determined.). If there was a `protocol` parameter, I could pass `VirtualService` URL as in `https://ray-cluster.<domain_name>` but at the same time I could specify protocol as `ray://`. This would help end users to use custom URLs without taking any other action.
