Skip to content

Commit bb676f5

Browse files
Add documentation for topologySpreadConstraint.
1 parent a7cc221 commit bb676f5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

docs/user.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ but Kubernetes will not spin up the pod if the requested HugePages cannot be all
714714
For more information on HugePages in Kubernetes, see also
715715
[https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/](https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/)
716716

717-
## Use taints, tolerations and node affinity for dedicated PostgreSQL nodes
717+
## Use taints, tolerations, node affinity and topology spread constraint for dedicated PostgreSQL nodes
718718

719719
To ensure Postgres pods are running on nodes without any other application pods,
720720
you can use [taints and tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)
@@ -755,6 +755,23 @@ spec:
755755
If you need to define a `nodeAffinity` for all your Postgres clusters use the
756756
`node_readiness_label` [configuration](administrator.md#node-readiness-labels).
757757

758+
If you need PostgreSQL Pods to run on separate nodes, you can use the
759+
[topologySpreadConstraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) to control how they are distributed across your cluster.
760+
This ensures they are spread among failure domains such as
761+
regions, zones, nodes, or other user-defined topology domains.
762+
763+
```yaml
764+
apiVersion: "acid.zalan.do/v1"
765+
kind: postgresql
766+
metadata:
767+
name: acid-minimal-cluster
768+
spec:
769+
topologySpreadConstraints:
770+
- maxskew: 1
771+
topologyKey: topology.kubernetes.io/zone
772+
whenUnsatisfiable: DoNotSchedule
773+
```
774+
758775
## In-place major version upgrade
759776

760777
Starting with Spilo 13, operator supports in-place major version upgrade to a
@@ -1053,7 +1070,7 @@ spec:
10531070
- all
10541071
volumeSource:
10551072
emptyDir: {}
1056-
sidecars:
1073+
sidecars:
10571074
- name: "container-name"
10581075
image: "company/image:tag"
10591076
volumeMounts:

0 commit comments

Comments
 (0)