使用 Taints 和 Tolerations
您可以使用 taints 和 tolerations 来控制 OpenTelemetry Collector pods 调度到哪些节点上。当您希望为可观测性工作负载专门使用特定的 基础设施节点 时,这非常有用。
将 Collector 调度到基础设施节点上
要将 OpenTelemetry Collector 调度到基础设施节点上,请在 OpenTelemetryCollector 自定义资源中配置 nodeSelector 和 tolerations 字段。
前提条件
- 必须安装 Alauda Build of OpenTelemetry v2 Operator。
- 必须为 基础设施节点 配置适当的标签和 taints。
操作步骤
-
验证您的基础设施节点是否已正确添加标签并设置 taints:
-
使用
nodeSelector和tolerations创建或更新OpenTelemetryCollector资源:- spec.nodeSelector:将 Collector pods 限制为仅在匹配指定标签的节点上运行。在本示例中,节点带有
node-role.kubernetes.io/infra: ""标签。 - spec.tolerations:允许将 Collector pods 调度到带有匹配 taints 的节点上。
NoSchedule效果会阻止没有此 toleration 的其他 pods 调度到这些节点上。 - spec.tolerations[].operator:设置为
Equal,以要求 taint 的 key 和 value 完全匹配。
- spec.nodeSelector:将 Collector pods 限制为仅在匹配指定标签的节点上运行。在本示例中,节点带有
验证
验证 Collector pods 是否已调度到基础设施节点上:
确认 NODE 列显示的是基础设施节点名称。