使用污点和容忍度
您可以使用污点和容忍度来控制 OpenTelemetry Collector pod 调度到哪些节点上。当您希望为可观测性工作负载专用特定的 基础设施节点 时,这会非常有用。
在基础设施节点上调度 Collector
要在基础设施节点上调度 OpenTelemetry Collector,请在 OpenTelemetryCollector 自定义资源中配置 nodeSelector 和 tolerations 字段。
先决条件
- 必须安装 Alauda 容器平台原生应用可观测性(之前称为 Alauda Build of OpenTelemetry v2)Operator。
- 必须使用适当的标签和污点配置 基础设施节点。
操作步骤
-
验证基础设施节点已正确添加标签和污点:
-
使用
nodeSelector和tolerations创建或更新OpenTelemetryCollector资源:- spec.nodeSelector:将 Collector pod 限制为仅在与指定标签匹配的节点上运行。在此示例中,节点带有
node-role.kubernetes.io/infra: ""标签。 - spec.tolerations:允许 Collector pod 调度到带有匹配污点的节点上。
NoScheduleeffect 可防止不具有此容忍度的其他 pod 调度到这些节点上。 - spec.tolerations[].operator:设置为
Equal,要求污点键和值完全匹配。
- spec.nodeSelector:将 Collector pod 限制为仅在与指定标签匹配的节点上运行。在此示例中,节点带有
验证
验证 Collector pod 已调度到基础设施节点上:
确认 NODE 列显示基础设施节点名称。