KubeRay 集成调度器插件#
kubernetes-sigs/scheduler-plugins 仓库提供了基于调度器框架的链式(out-of-tree)调度器插件。
从 KubeRay v1.4.0 开始,KubeRay 集成了调度器插件提供的 PodGroup API,以支持 RayCluster 自定义资源的批量调度(gang scheduling)。
步骤 1:使用 Kind 创建 Kubernetes 集群#
kind create cluster --image=kindest/node:v1.26.0
步骤 2:安装调度器插件#
请按照调度器插件仓库中的 安装指南 进行安装。
注意
安装调度器插件有两种模式:单调度器模式 (single scheduler mode) 和 副调度器模式 (second scheduler mode)。
KubeRay v1.4.0 仅支持 单调度器模式 (single scheduler mode)。您需要能够配置 Kubernetes 控制平面,将默认调度器替换为调度器插件。
步骤 3:安装启用了调度器插件的 KubeRay operator#
KubeRay v1.4.0 及更高版本支持调度器插件。
helm install kuberay-operator kuberay/kuberay-operator --version 1.5.1 --set batchScheduler.name=scheduler-plugins
步骤 4:部署支持批量调度的 RayCluster#
# Configure the RayCluster with label `ray.io/gang-scheduling-enabled: "true"`
# to enable gang scheduling.
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/release-1.4/ray-operator/config/samples/ray-cluster.scheduler-plugins.yaml
步骤 5:验证 Ray Pod 和 PodGroup#
请注意,如果您使用“副调度器模式 (second scheduler mode)”(KubeRay 目前不支持),以下命令仍然会显示类似的结果。但是,Ray Pods 将不会以批量调度的方式进行调度。请确保使用“单调度器模式 (single scheduler mode)”来启用批量调度。
kubectl get podgroups.scheduling.x-k8s.io
# NAME PHASE MINMEMBER RUNNING SUCCEEDED FAILED AGE
# test-podgroup-0 Running 3 3 2m25s
# All Ray Pods (1 head and 2 workers) belong to the same PodGroup.
kubectl get pods -L scheduling.x-k8s.io/pod-group
# NAME READY STATUS RESTARTS AGE POD-GROUP
# test-podgroup-0-head 1/1 Running 0 3m30s test-podgroup-0
# test-podgroup-0-worker-worker-4vc6j 1/1 Running 0 3m30s test-podgroup-0
# test-podgroup-0-worker-worker-ntm9f 1/1 Running 0 3m30s test-podgroup-0