Skip to content

Affinity📜

Pod constraints for Istio are implemented following the kubernetes affinity documentation. Istio can constraint a pod using nodeSelector, nodeAffinity, or the pod Affinity/Anti-affinity feature.

nodeSelector📜

in the values.yaml add nodeSelector like:

 nodeSelector:
    <key>: <values>

nodeAffinity📜

in the values.yaml, add nodeAffinity like:

affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: kubernetes.io/e2e-az-name
            operator: In
            values:
            - e2e-az1
            - e2e-az2
      preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 1
        preference:
          matchExpressions:
          - key: another-node-label-key
            operator: In
            values:
            - another-node-label-value

podAffinity📜

In values.yaml add pod affinity/anti-affinity like:

affinity:
    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: security
            operator: In
            values:
            - S1
        topologyKey: topology.kubernetes.io/zone
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
            - key: security
              operator: In
              values:
              - S2
          topologyKey: topology.kubernetes.io/zone

Last update: 2021-06-18 by Michael McLeroy