预期的错误节点类型:SequenceNode 是 MappingNode

wrong Node Kind for expected: SequenceNode was MappingNode

我有这个清单

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cert-manager
  namespace: "cert-manager"
spec:
  template:
    spec:
      containers:
        nodeSelector:
          app.myapp.com/environment: system

当我尝试使用 kubectl 申请时,出现此错误:

error: wrong Node Kind for expected: SequenceNode was MappingNode: value: {nodeSelector: app.myapp.com/environment: system}

可以是什么?

正如@mdaniel所说,容器是一个数组,你必须在容器中提到字段名称以“-”开头。在您的用例中,从 nodeSelector: 中删除前导“-”已将容器从数组成员转变为字典。因此,您需要在 nodeSelector 字段中提及“-”。

有关如何定义容器的详细信息,请参阅 Deployments