Skip to main content

MarkLogic Server on Kubernetes

Topology spread constraints

Topology spread constraints and the actualSkew and maxSkew parameters control the spread of pods among worker nodes and zones in a cluster.

  • actualSkew is the difference between the number of pods in the most populated worker nodes or availability zones, and the number of pods in the least populated worker nodes or availability zones.

  • maxSkew is the maximum degree to which pods may be unevenly distributed.

For additional information and examples, see GitHub.

The MarkLogic Helm Chart defaults to this configuration:

 - maxSkew: 1
    topologyKey: kubernetes.io/hostname
    whenUnsatisfiable: DoNotSchedule
    labelSelector:
      matchLabels:
        app.kubernetes.io/name: marklogic
  - maxSkew: 1
 topologyKey: topology.kubernetes.io/zone
    whenUnsatisfiable: ScheduleAnyway
    labelSelector:
      matchLabels:
        app.kubernetes.io/name: marklogic

In the first rule, topologyKey is set to the hostname. This ensures that MarkLogic pods are scheduled to all the available worker nodes evenly and that maxSkew is not exceeded.

In the second rule, the topologyKey is set to the zone. This setting attempts to schedule the pods onto worker nodes located in different availability zones. If the topologyKey zone has an even distribution, the rule only applies to nodes with the label zone: <any value>. Nodes without a zone label are skipped.

When the actualSkew of all the nodes exceeds maxSkew, the rules are unsatisfied. When the rules are unsatisfied, whenUnsatisfiable controls what happen next:

  • if whenUnsatisfiable is set to DoNotSchedule, pods are not scheduled to the worker nodes.

  • If whenUnsatisfiable is set to ScheduleAnyway, pods are scheduled to the worker nodes. Pods are scheduled even if the rule is unsatisfied.