简体   繁体   English

yaml 解析错误舵

[英]yaml parse error helm

im getting我越来越

Error: YAML parse error on myApp-infra/templates/my.yaml: error converting YAML to JSON: yaml: line 20: found unexpected ':'错误:myApp-infra/templates/my.yaml 上的 YAML 解析错误:将 YAML 转换为 JSON 时出错:yaml:第 20 行:发现意外的“:”

below is helm install --dry-run --debug ./myApp output下面是 helm install --dry-run --debug ./myApp 输出

kind: Service
apiVersion: v1
metadata:
  name: spark-slave-service
  labels:
    app: spark-slave
spec:
  selector:
    app: spark-slave
  clusterIP: None
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: spark-slave-deployment
spec:
  selector:
    matchLabels:
      app: spark-slave
  serviceName: "spark-slave-service"
  replicas: 3 # tells deployment to run 2 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      labels:
        app: spark-slave
    spec:
      containers:
      - name: spark-slave-container
        image: <image url>
        command: [<mycommand>
        volumeMounts:
        - mountPath: "/tmp/data"
          name: slave-pvc
  volumeClaimTemplates:
  - metadata:
      labels:
        app: spark-slave
      name: slave-pvc
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: "rook-block"

When helm encounters parse errors while processing multiple YAML documents in a single file (like your case) the error message can be a bit misleading.当 helm 在单个文件中处理多个 YAML 文档时遇到解析错误(如您的情况),错误消息可能有点误导。 Although it says line 20 , that point is in reference to the beginning of one of the YAML documents in the file, not the beginning of the file itself.尽管它说的是line 20 ,但该点是指文件中一个 YAML 文档的开头,而不是文件本身的开头。 With most parse errors, you should check the line it mentions as well as the previous line for issues.对于大多数解析错误,您应该检查它提到的行以及前一行是否有问题。 In your case, it looks like Line 19 of the StatefulSet document on the command line would cause it.在您的情况下, command行上 StatefulSet 文档的第 19 行看起来会导致它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM