affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - myPjName
              topologyKey: topology.kubernetes.io/zone


这里要配置
preferredDuringSchedulingIgnoredDuringExecution: 意思是软亲和性(不强求),如果配置requiredDuringSchedulingIgnoredDuringExecution(硬亲和性)会报错。

参考文档:https://kubernetes.io/zh/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity