The virtual service created:
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: ray-head-virtual-service
namespace: kuberay
spec:
hosts:
- ray-jobs.example.com
gateways:
- istio-system/ingressgateway
http:
- route:
- destination:
host: kuberay-head-svc.kuberay.svc.cluster.local
port:
number: 8265
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: ray-head-gateway
namespace: kuberay
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "ray-jobs.example.com"
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ray-head-ingress
namespace: kuberay
spec:
rules:
- host: ray-jobs.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: istio-ingressgateway
port:
number: 80
After understood properly the JobSubmissionClient approach, I have generated the above virtual service, but the external dns is not connecting. but, I have tried with internal svc its working.
import ray
from ray.job_submission import JobSubmissionClient
import time
ray_head_ip = "kuberay-head-svc.kuberay.svc.cluster.local"
ray_head_port = 8265
ray_address = f"http://{ray_head_ip}:{ray_head_port}"