I deployed a Ray cluster on an AKS cluster. To run my applications leveraging the Ray cluster, currently I'm deploying each of my applications as a classic k8s Deployment object and connecting to the Ray cluster using
ray.init(address="<head-node-ip:10001")
The problem is that I'm manually inserting the head node IP by looking at the head node ip through kubectl describe pod head-node-pod
. Is there a way to get it automatically ?
Thanks in advance.
CodePudding user response:
I think you should be leveraging on Kubernetes services and use the DNS instead of IP.
so in your case, the DNS would be head-node-svc.your-namespace.svc.cluster.local
where head-node-svc is your new service associated with head node pod, your-namespace is your namespace where the pods and services are created, svc stays there as it is and cluster.local is your cluster domain.