Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 1 个主节点和 4 个工作节点的裸机 kubernetes 集群。我想在每 4 个工作节点上部署我的部署对象,但我不能。我尝试nodeSelector但看起来它只适用于最后一个键:值对标签。
请帮我。
如果您想确保所有节点上都有该 pod,您可以使用DaemonSet。
您还可以使用亲和/反亲和选择器。
pod 间亲和性和反亲和性允许您根据节点上已经运行的 pod 上的标签而不是基于节点上的标签来限制您的 pod 有资格调度的节点。规则的形式是“如果 X 已经在运行一个或多个符合规则 Y 的 pod,则该 pod 应该(或者,在反亲和的情况下,不应该)在 X 中运行”</p>
如果您不希望两个实例位于同一主机上,请查看以下链接
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#never-co-located-in-the-same-node