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
CodePudding user response:
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.
CodePudding user response:
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 runs on a policy of "one pod per node" -- you CAN'T make it HA, and you will have as many replicas of the daemonset as you have nodes - no more, no less. As the name suggests this is generally used for daemon processes which must run on every node, such as logging agents.
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:
- Make sure you have at least 3 replicas (4 is a good starter number)
- Add tolerations if you must schedule those pods on a node pool that has taints
- 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)
- 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
- 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)
- 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.
- Setup pod disruption budgets, and horizontal pod autoscalers to ensure an agreed number of pods are always up.