0

这是我在此处关于图表验证的前一个问题的后续问题 尝试部署 helm 图表时,我有一个错误显示如下:

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:

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

4

1 回答 1

1

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

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

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

既然name实际上是 的一个属性Container,那就抱怨mountPath

我不知道你想挂载在哪里.mina-config,但它应该嵌套volumeMounts在 a 内的属性内Container,而不是与容器处于同一级别。

于 2021-11-17T14:05:57.033 回答