Skip to content

Commit a190b51

Browse files
authored
Merge pull request #5080 from MyMirelHub/affinity-docs
[1.18] Docs on affinity spread for placement and scheduler
2 parents 5a670e0 + dca68a9 commit a190b51

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

daprdocs/content/en/operations/hosting/kubernetes/kubernetes-production.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,30 @@ To scale scheduler and placement to three instances independently of the `global
122122
--wait
123123
```
124124

125+
### Spreading Placement and Scheduler replicas
126+
127+
With HA enabled, the default Helm values add pod anti-affinity so Scheduler and Placement service replicas are attempted to be scheduled across different failure domains if cluster resourcing allows. This is configured using the following Helm chart [options](https://github.com/dapr/dapr/blob/master/charts/dapr/README.md)
128+
129+
- `global.ha.topologyKey`: Kubernetes label used meaning “different domain”. Set by default to `topology.kubernetes.io/zone`.
130+
- `global.ha.podAntiAffinityPolicy`: Enables soft spreading with `preferredDuringSchedulingIgnoredDuringExecution` (the default) or hard spreading with `requiredDuringSchedulingIgnoredDuringExecution`.
131+
132+
When running in production, consider the following recommendations.
133+
134+
1. **Availability zones**: The default topology key spreads pods across zones. This limits the chance that a single zone outage removes multiple Scheduler or Placement pods at the same time.
135+
2. **Single zone, many nodes**: Zone labels are often identical across the cluster; set `topologyKey` to `kubernetes.io/hostname` to enable spreading by node.
136+
3. **Soft spreading**: The default behaviour is recommended here allowing pod scheduling to succeed when the cluster is short on zones or nodes.
137+
4. **Hard spreading**: Only use when you must never place two replicas on the same topology value. This requires as many distinct values for `topologyKey` as replicas, or pods will stay `Pending`.
138+
139+
For example, too configure hard spreading by hostname in a single-zone cluster, use the following Helm values:
140+
141+
```yaml
142+
global:
143+
ha:
144+
enabled: true
145+
topologyKey: kubernetes.io/hostname
146+
podAntiAffinityPolicy: requiredDuringSchedulingIgnoredDuringExecution
147+
```
148+
125149
## Setting cluster critical priority class name for control plane services
126150

127151
In some scenarios, nodes may have memory and/or cpu pressure and the Dapr control plane pods might get selected

0 commit comments

Comments
 (0)