You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Pod配置affinity正常 新增podAntiAffinity规则后部署报错如何解决

问题原因分析

报错核心是YAML配置的字段类型与Confluent for Kubernetes CRD定义的要求不匹配:
podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution 字段在Kubernetes亲和性规范中要求传入规则数组,但你当前的配置给这个字段赋值的是单个规则对象(即map类型),因此触发了类型校验失败的错误。

修复步骤
  1. 找到你iris-streaming-connect.yaml中配置podAntiAffinity的部分
  2. 给requiredDuringSchedulingIgnoredDuringExecution下的规则套一层数组结构,也就是在规则前加短横线-

错误配置示例

spec:
  podTemplate:
    affinity:
      podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          labelSelector:
            matchLabels:
              app: iris-streaming-connect
          topologyKey: kubernetes.io/hostname

正确配置示例

spec:
  podTemplate:
    affinity:
      podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchLabels:
              app: iris-streaming-connect
          topologyKey: kubernetes.io/hostname
注意事项
  • 如果需要配置多条反亲和调度规则,在同层级继续添加-开头的规则对象即可
  • 软反亲和字段preferredDuringSchedulingIgnoredDuringExecution同样要求数组类型,配置时需遵循相同规范
  • 不要直接使用--validate=false参数跳过校验,否则反亲和规则不会生效,还可能引发后续调度逻辑异常

内容的提问来源于stack exchange,提问作者Enjay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 22:18:04