Skip to content

podAntiAffinity

Feature state: 1.0.0

podAntiAffinity can prevent the scheduler from placing application replicas on the same node.

The value soft means that the scheduler should prefer to not schedule two replica pods onto the same node but no guarantee is provided.

The value hard means that the scheduler is required to not schedule two replica pods onto the same node.

The default value "" will disable pod anti-affinity so that no anti-affinity rules will be configured.

Note

By default podAntiAffinity is undefined.

Define podAntiAffinity

values.yaml
1
2
3
4
5
6
7
8
nameOverride: my-app
image:
  repository: nginx
  tag: latest

replicaCount: 3

podAntiAffinity: "soft"
Deploy command
helm install webapp sysbee/kubedeploy -f values.yaml

In the above example three replicas of application would prefer to be scheduled on different Kubernetes nodes.

For more examples please see the Best practices linked below.

See also: