K8s 守护进程设置高可用性

发布于 2025-01-10 06:31:17 字数 615 浏览 0 评论 0原文

我们有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红衣飘飘貌似仙 2025-01-17 06:31:17

您问了两个有些不相关的问题。

以下内容是否也适用于 deamaon 集的 HA?

  • 亲和性(反亲和性)
  • 容忍度
  • pdb

A daemonset (通常)运行在“每个节点一个 pod”的策略——您不能使其具有高可用性(例如,通过使用自动缩放),并且您将(假设您使用默认值)拥有尽可能多的 Pod当您拥有节点时,daemonset 的副本,除非您使用 nodeSelector 和/或 tolerations 等方式明确指定要运行 daemonset pod 的节点,其中如果你的豆荚会更少。上面链接的文档页面提供了更多详细信息并包含一些示例

这不是我们的应用程序,但我们需要确保它是 HA,因为它是关键应用程序

您是否询问如何使您的关键应用程序高可用性?我假设你是。

如果应用程序像您所说的那样重要,那么有一些入门建议:

  1. 确保您至少有 3 个副本(4 是一个很好的入门数量)
  2. 如果必须在有污点的节点池上安排这些 Pod,请添加容忍
  3. 使用节点选择器根据需要(例如,对于区域或区域,但仅在必要时才对这些区域中存在的磁盘等进行操作)
  4. 使用关联性来分组或传播副本。绝对会建议使用传播,这样如果一个节点出现故障,其他副本仍然正常
  5. 使用 pod 优先级 向集群表明您的 pod 比其他 pod 更重要(请注意,如果设置得太高,可能会导致问题)
  6. 将通知设置为类似PagerDuty、OpsGenie 等,因此如果应用程序出现故障,您(或您的运营团队)会收到通知。如果该应用程序很重要,那么您会想知道它已尽快关闭。
  7. 设置pod 中断预算,以及水平 Pod自动缩放器,以确保约定数量的 Pod 始终处于运行状态。

You have asked two, somewhat unrelated questions.

does the following is applicable for HA for deamaon set also?

  • affinity (anti affinity)
  • toleration's
  • pdb

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/or tolerations, in which case you will have less pods. The documentation page linked above gives more details and has some examples

this is not our app but we need to make sure it is HA as it's critical app

Are 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:

  1. Make sure you have at least 3 replicas (4 is a good starter number)
  2. Add tolerations if you must schedule those pods on a node pool that has taints
  3. Use node selectors as needed (e.g. for regions or zones, but only if necessary do to something like disks being present in those zones)
  4. Use affinity to group or spread your replicas. Definitely would recommend using a spread so that if one node goes down, the other replicas are still up
  5. Use a pod priority to indicate to the cluster that your pods are more important than other pods (beware this may cause issues if you set it too high)
  6. Setup notifications to something like PagerDuty, OpsGenie, etc, so you (or your ops team) are notified if the app goes down. If the app is critical, then you'll want to know it's down ASAP.
  7. Setup pod disruption budgets, and horizontal pod autoscalers to ensure an agreed number of pods are always up.
小清晰的声音 2025-01-17 06:31:17

您无法控制 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文