PodTopologySpread allows defining the spreading constraints for workloads with a flexible and expressive Pod-level API. It includes a few settings, some of which are:
maxSkew- describes the maximum degree to which Pods can be unevenly distributed across nodes/zones/etc.
whenUnsatisfiabletells the scheduler how to deal with a Pod if it doesn't satisfy the spread constraints; whether to schedule it or not. In practice, it specifies what action should be taken when
maxSkewcan't be satisfied.
DoNotSchedule will cause pods to be “unschedulable” if the topology spread constraint can't be fulfilled. It should only be set if it's preferable for pods to not run instead of violating the topology spread constraint.
Targeted objects by this rule (types of
kind): Deployment / Pod / DaemonSet / StatefulSet / ReplicaSet / CronJob / Job
Complexity: easy (What does this mean?)
Policy as code identifier: EKS_INVALID_VALUE_DONOOTSCHEDULE
This rule will fail
whenUnsatisfiable is set to
- maxSkew: 1
Rule output in the CLI
$ datree test *.yaml
>> File: failExample.yaml
❌ Prevent pods from becoming unschedulable [1 occurrence]
💡 Incorrect value for key `whenUnsatisfiable` - use a different value to ensure your pod does not become unschedulable
How to fix this failure
- maxSkew: 1