如何定义 pGPU 成本模型
目录
前提条件关于 Alauda Build of NVIDIA GPU Device Plugin操作步骤创建 PrometheusRule 以生成所需指标添加采集配置(Cost Management Agent)添加展示/存储配置(Cost Management Server)为 pGPU 成本模型添加价格计费方式说明成本明细和成本统计前提条件
在 GPU 集群中:
- 已安装 Alauda Build of NVIDIA GPU Device Plugin
- 已安装 Cost Management 智能体
关于 Alauda Build of NVIDIA GPU Device Plugin
适用于 Kubernetes 的 NVIDIA device plugin 是一个 DaemonSet,可让你自动执行以下操作:
- 暴露集群中每个节点上的 GPU 数量
- 跟踪 GPU 的健康状态
- 在 Kubernetes 集群中运行启用了 GPU 的容器
Note
因为 Alauda Build of NVIDIA GPU Device Plugin 的发版周期与灵雀云容器平台不同,所以 Alauda Build of NVIDIA GPU Device Plugin 的文档现在作为独立的文档站点托管在 Alauda Build of NVIDIA GPU Device Plugin。
操作步骤
创建 PrometheusRule 以生成所需指标
在 GPU 集群中创建一个 PrometheusRule。
添加采集配置(Cost Management Agent)
在运行 Cost Management 智能体的 GPU 集群中创建一个 ConfigMap,用于声明要采集的内容。
添加 yaml 后,需要重启 Agent Pod 以重新加载配置。
添加展示/存储配置(Cost Management Server)
在运行 Cost Management Server 的集群中创建一个 ConfigMap,用于声明计费项、计费方式、单位和显示名称。这会告诉服务器要计什么费以及如何计费。
添加 yaml 后,需要重启 Server Pod 以重新加载配置。
为 pGPU 成本模型添加价格
计费方式说明
如果 GPU 集群没有 Cost model,则需要创建一个新的 cost model。
然后可以为 GPU 集群的 cost model 添加价格:
- 在 Billing Items 中选择
pGPU。 - 在 Method 中选择
Request Usage (count-hours)或Project Quota (count-hours)。 - 设置 Default Price。
- 配置 Price By Label(可选)。
示例:
key: modelName
value: "Tesla P100-PCIE-16GB" 或 "Tesla T4" 或 "NVIDIA A30"(可通过运行nvidia-smi获取)
成本明细和成本统计
最后,在等待 1 个或多个小时后,你可以在 Cost Details 中看到按 namespace 和 card uuid 维度展示的成本明细。
同时,你还可以在 Cost Statistics 中看到基于 cluster、project 和 namespace 的总成本。