云容器引擎 CCE-准备GPU虚拟化资源:步骤三(可选):修改Volcano调度策略

时间:2024-04-03 08:02:20

步骤三(可选):修改Volcano调度策略

Volcano针对GPU节点的调度策略默认为Spread,即如果节点配置相同,会选择一个正在运行的容器数量最少的节点,可以尽量将容器平均分配到各个节点。而Binpack调度策略与之相反,它会尽可能的把所有的容器调度到一台节点上运行,尽量少用节点,避免资源碎片化。

如果在使用GPU虚拟化特性时需要使用Binpack调度策略,可以在Volcano插件的高级配置中进行修改,具体操作步骤如下。

  1. 登录CCE控制台,单击集群名称进入集群,在左侧选择“插件中心”。
  2. 在右侧找到Volcano调度器插件,单击“编辑”
  3. 在编辑插件页面,修改插件的“高级配置”。

    1. nodeorder插件中,添加arguments参数,配置leastrequested.weight为0,即资源分配最少的节点优先级设置为0。
    2. 新增binpack插件,并指定xGPU自定义资源(volcano.sh/gpu-core.percentagevolcano.sh/gpu-mem.128Mi)的权重。
    完整示例如下:
    {
        "colocation_enable": "",
        "default_scheduler_conf": {
            "actions": "allocate, backfill, preempt",
            "tiers": [
                {
                    "plugins": [
                        {
                            "name": "priority"
                        },
                        {
                            "enablePreemptable": false,
                            "name": "gang"
                        },
                        {
                            "name": "conformance"
                        }
                    ]
                },
                {
                    "plugins": [
                        {
                            "enablePreemptable": false,
                            "name": "drf"
                        },
                        {
                            "name": "predicates"
                        },
                        {
                            "name": "nodeorder",
                            //将资源分配最少的节点优先级设置为0
                            "arguments": {
                                "leastrequested.weight": 0
                            }
                        }
                    ]
                },
                {
                    "plugins": [
                        {
                            "name": "cce-gpu-topology-predicate"
                        },
                        {
                            "name": "cce-gpu-topology-priority"
                        },
                        {
                            "name": "xgpu"
                        },
                        //添加binpack插件,指定xGPU资源的权重。
                        {
                            "name": "binpack",
                            "arguments": {
                                "binpack.resources": "volcano.sh/gpu-core.percentage,volcano.sh/gpu-mem.128Mi",
                                "binpack.resources.volcano.sh/gpu-mem.128Mi": 10,
                                "binpack.resources.volcano.sh/gpu-core.percentage": 10
                            }
                        }
                    ]
                },
                {
                    "plugins": [
                        {
                            "name": "nodelocalvolume"
                        },
                        {
                            "name": "nodeemptydirvolume"
                        },
                        {
                            "name": "nodeCSIscheduling"
                        },
                        {
                            "name": "networkresource"
                        }
                    ]
                }
            ]
        },
        "tolerations": [
            {
                "effect": "NoExecute",
                "key": "node.kubernetes.io/not-ready",
                "operator": "Exists",
                "tolerationSeconds": 60
            },
            {
                "effect": "NoExecute",
                "key": "node.kubernetes.io/unreachable",
                "operator": "Exists",
                "tolerationSeconds": 60
            }
        ]
    }

support.huaweicloud.com/usermanual-cce/cce_10_0645.html