K8s 守护进程设置高可用性
我们有一个deamonset,我们希望使其成为HA(不是我们的deamonset),以下内容是否也适用于deamaon集的HA?
- 亲和力(反亲和力)
- 容忍度的
- pdb
我们在每个集群上有 3 个工作节点 我过去是为了部署而这样做的,但不确定什么也适用于 deamonset,这不是我们的应用程序,但我们需要确保它是 HA,因为它是关键应用程序
更新 >
将以下内容添加到 deamonset 是否有意义,假设我有 3 个工作节点,并且我希望仅在 foo
工作节点中调度它?
spec:
tolerations:
- effect: NoSchedule
key: WorkGroup
operator: Equal
value: foo
- effect: NoExecute
key: WorkGroup
operator: Equal
value: foo
nodeSelector:
workpcloud.io/group: foo
we have a deamonset and we want to make it HA (not our deamonset), does the following is applicable for HA for deamaon set also?
- affinity (anti affinity)
- toleration's
- pdb
we have on each cluster 3 worker nodes
I did it in the past for deployment but not sure what is also applicable for deamonset, this is not our app but we need to make sure it is HA as it's critical app
update
Does it make sense to add the following to deamonset, lets say I've 3 worker nodes and I want it to be scheduled only in foo
workers nodes?
spec:
tolerations:
- effect: NoSchedule
key: WorkGroup
operator: Equal
value: foo
- effect: NoExecute
key: WorkGroup
operator: Equal
value: foo
nodeSelector:
workpcloud.io/group: foo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您问了两个有些不相关的问题。
A daemonset (通常)运行在“每个节点一个 pod”的策略——您不能使其具有高可用性(例如,通过使用自动缩放),并且您将(假设您使用默认值)拥有尽可能多的 Pod当您拥有节点时,daemonset 的副本,除非您使用
nodeSelector
和/或tolerations
等方式明确指定要运行 daemonset pod 的节点,其中如果你的豆荚会更少。上面链接的文档页面提供了更多详细信息并包含一些示例您是否询问如何使您的关键应用程序高可用性?我假设你是。
如果应用程序像您所说的那样重要,那么有一些入门建议:
You have asked two, somewhat unrelated questions.
A daemonset (generally) runs on a policy of "one pod per node" -- you CAN'T make it HA (for example, by using autoscaling), and you will (assuming you use defaults) have as many replicas of the daemonset as you have nodes, unless you explicitly specify which nodes you want to want to run the daemonset pods, using things like
nodeSelector
and/ortolerations
, in which case you will have less pods. The documentation page linked above gives more details and has some examplesAre you asking how to make your critical app HA? I'm going to assume you are.
If the app is as critical as you say, then a few starter recommendations:
您无法控制 DaemonSet 中的副本,因为 DaemonSet 每个节点都有一个 pod。
您需要将对象更改为 Deployment 或 Statefulset 来管理副本计数并使用 nodeSelector 将其部署在所有节点中。
You can not control the replicas in DaemonSet as DaemonSet will have one pod per node.
you need to change the object to either Deployment or Statefulset to manage the replica count and use the nodeSelector to deploy it in all the nodes.