Setup a loadbalancer for Ray deployment on K8

Hi there,

I’m trying to set up a load balancer server for Ray which I deployed using the .yaml file provided in Ray’s documentation. For that effect, I’m trying to use the following .yml file but I keep getting errors about the type of services. Is there any example of how to set up the lb service? Thanks!

apiVersion: v1
kind: Service
namespace: ray
name: ray-head-lb
app: ray-head
- port: 8265
targetPort: 8265
- port: 50051
targetPort: 50051
type: LoadBalancer

Just to make sure we’re on the same page, is this the config used to deploy?

Could you provide more details on the error you’re getting?

Thanks Dmitri. Here 3 highlights:

  1. I used the files from ray/doc/kubernetes at master · ray-project/ray · GitHub
    To deploy the cluster I used the ray-cluster.yml. file.

Please notice that when start ray on the head, I get the following messages back:

kubectl -n ray exec -it ray-head-6fc7dffbc8-skq9j – bash
(base) ray@ray-head-6fc7dffbc8-skq9j:/$ python -m ray.util.client.server
2021-01-27 07:39:02,797 INFO – View the Ray dashboard at
2021-01-27 07:39:05,191 INFO – Starting Ray Client server on

  1. To define the LB service for the head, I had to run:
    kubectl -n ray expose replicaset ray-head-6fc7dffbc8 --port=50051 --target-port=50051 --name=ray-head-svc --type=LoadBalancer

This worked, although it’d be better to use the .yaml deployment file to implement the LB.

  1. I also ran the following to get access to the dashboard, however, my browser does not see anything on port 8265.

kubectl -n ray expose replicaset ray-head-6fc7dffbc8 --port=8265 --target-port=8265 --name=ray-head-dashb --type=LoadBalancer

Your guidance is much appreciated. Enrique