How to solve this helm error "Error: UPGRADE FAILED: error validating "": error validating data"?

How to solve this helm error "Error: UPGRADE FAILED: error validating "": error validating data"?

这是我之前关于图表验证问题的后续问题 在尝试部署 helm chart 时,出现如下错误:

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.initContainers[1]): unknown field "mountPath" in io.k8s.api.core.v1.Container
make: *** [upgrade] Error 1

FWIW,这是下面的 initcontainer spec 详细信息:

spec:
      initContainers:
      {{- if .Values.libp2p.staticKeypair.enabled}}
      - name: libp2p-init-my-service
        image: busybox:1.28
        command: ['sh', '-c', '/bin/cp /libp2p-keys/* /root/libp2p-keys && /bin/chmod -R 0700 /root/libp2p-keys/']
        volumeMounts:
        - mountPath: /libp2p-keys
          name: source-libp2p-keys 
        - mountPath: /root/libp2p-keys
          name: destination-libp2p
      {{- end }}
      - name: config-dir
        mountPath: /root/.mina-config
      - name: fix-perms
        image: busybox:1.28
        command: [ 'sh', '-c', 'for dir in keys echo-keys faucet-keys; do [ -d /$dir ] && /bin/cp /$dir/* /wallet-keys; done; /bin/chmod 0700 /wallet-keys']
        volumeMounts:
        - mountPath: "/keys/"
          name: private-keys
          readOnly: true
        - mountPath: /wallet-keys
          name: wallet-keys
      containers:

可能的原因是什么,我该如何处理?

您正在使用 YAML,因此请注意缩进,因为它非常重要。

由于您要声明 initContainers,因此您在第一层定义 Containers;但您在该级别包括以下内容:

- name: config-dir
  mountPath: /root/.mina-config

由于name实际上是Container的一个属性,它抱怨mountPath

我不知道你想挂载 .mina-config 的位置,但它应该嵌套在 Container 内的 volumeMounts 属性内,而不是与集装箱。